From c8ea937a99ee1876056e03f5336173d2bd6333c6 Mon Sep 17 00:00:00 2001 From: Jan Sandbrink Date: Tue, 5 May 2026 09:19:10 +0200 Subject: [PATCH] Fix delete confirmation text The term "token" and "active was duplicated in the translation. It has now been simplified to only translate on a single level, not used two nested translations. --- .../access_token/oauth_application/row_component.rb | 13 +++++++------ config/locales/en.yml | 7 +++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/components/my/access_token/oauth_application/row_component.rb b/app/components/my/access_token/oauth_application/row_component.rb index 4034b5f4609..7ac00979181 100644 --- a/app/components/my/access_token/oauth_application/row_component.rb +++ b/app/components/my/access_token/oauth_application/row_component.rb @@ -46,9 +46,13 @@ module My end end + def active_token_count + oauth_application_tokens.count { |t| !t.expired? && !t.revoked? } + end + def active_tokens render(Primer::Beta::Text.new(test_selector: "oauth-application-#{oauth_application.id}-active-tokens")) do - oauth_application_tokens.count { |t| !t.expired? && !t.revoked? }.to_s + active_token_count.to_s end end @@ -74,11 +78,8 @@ module My data: { turbo_method: :post, turbo_confirm: t( - "oauth.revoke_my_application_confirmation", - token_count: t( - "oauth.x_active_tokens", - count: oauth_application_tokens.count - ) + "oauth.confirm_revoke_my_application", + count: active_token_count ) } )) diff --git a/config/locales/en.yml b/config/locales/en.yml index 0319501ef85..f4f338970ce 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -6279,9 +6279,6 @@ en: scopes: "Permissions" successful_application_revocation: "Revocation of application %{application_name} successful." none_given: "No OAuth applications have been granted access to your user account." - x_active_tokens: - one: "one active token" - other: "%{count} active token" flows: authorization_code: "Authorization code flow" client_credentials: "Client credentials flow" @@ -6291,8 +6288,10 @@ en: client_credentials_impersonation_html: > By default, OpenProject provides OAuth 2.0 authorization via %{authorization_code_flow_link}. You can optionally enable %{client_credentials_flow_link}, but you must provide a user on whose behalf requests will be performed. + confirm_revoke_my_application: + one: "Do you really want to remove this application? This will revoke one token active for it." + other: "Do you really want to remove this application? This will revoke %{count} tokens active for it." authorization_error: "An authorization error has occurred." - revoke_my_application_confirmation: "Do you really want to remove this application? This will revoke %{token_count} active for it." my_registered_applications: "Registered OAuth applications" oauth_client: