diff --git a/app/controllers/api/v1/archive_controller.rb b/app/controllers/api/v1/archive_controller.rb index fb6f4e47bcd..8440665c84f 100644 --- a/app/controllers/api/v1/archive_controller.rb +++ b/app/controllers/api/v1/archive_controller.rb @@ -1,4 +1,4 @@ -class Api::V1::ArchiveController < Api::BaseController +class Api::V1::ArchiveController < Api::BaseController before_action :authenticate_with_api_key before_action :verify_with_otp before_action :find_rubygem diff --git a/app/models/api_key.rb b/app/models/api_key.rb index 4837033b74d..c51d9cf595e 100644 --- a/app/models/api_key.rb +++ b/app/models/api_key.rb @@ -3,7 +3,8 @@ class ScopeError < RuntimeError; end API_SCOPES = %i[show_dashboard index_rubygems push_rubygem yank_rubygem archive_rubygem unarchive_rubygem add_owner remove_owner access_webhooks configure_trusted_publishers].freeze - APPLICABLE_GEM_API_SCOPES = %i[push_rubygem yank_rubygem archive_rubygem unarchive_rubygem add_owner remove_owner configure_trusted_publishers].freeze + APPLICABLE_GEM_API_SCOPES = %i[push_rubygem yank_rubygem archive_rubygem unarchive_rubygem add_owner remove_owner + configure_trusted_publishers].freeze EXCLUSIVE_SCOPES = %i[show_dashboard].freeze self.ignored_columns += API_SCOPES diff --git a/config/locales/de.yml b/config/locales/de.yml index fdbace32003..1d125e6a23b 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -786,6 +786,7 @@ de: show_all_versions: Zeige alle Versionen (%{count} total) versions_header: Versionen yanked_notice: + archived_notice: show_yanked: not_hosted_notice: Dieses Gem wird aktuell nicht auf RubyGems.org gehostet. reserved_namespace_html: @@ -1055,3 +1056,8 @@ de: api_key_gem_html: api_key_mfa: not_required: + archive: + create: + success: + destroy: + success: diff --git a/config/locales/es.yml b/config/locales/es.yml index 4c4f5d65958..789f79c3629 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -801,6 +801,7 @@ es: versions_header: Versiones yanked_notice: Esta versión fue borrada, y no está disponible para su descarga directa ni por otras gemas que puedan haber dependido de la misma. + archived_notice: show_yanked: not_hosted_notice: Esta gema no está alojada actualmente en RubyGems.org. Es posible que ya exista alguna versión borrada de esta gema. @@ -1110,3 +1111,8 @@ es: api_key_gem_html: api_key_mfa: not_required: + archive: + create: + success: + destroy: + success: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 84a029f80e7..57f8f36d046 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -724,6 +724,7 @@ fr: versions_header: Versions yanked_notice: 'Retrait de Gem : disponible ni directement, ni pour les gems qui en dépendraient.' + archived_notice: show_yanked: not_hosted_notice: Gem non hébergé sur Rubygems pour le moment. reserved_namespace_html: @@ -1005,3 +1006,8 @@ fr: api_key_gem_html: api_key_mfa: not_required: + archive: + create: + success: + destroy: + success: diff --git a/config/locales/ja.yml b/config/locales/ja.yml index a2c008f9079..00a735b4e02 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -693,6 +693,7 @@ ja: show_all_versions: 全てのバージョンを表示(全%{count}件) versions_header: バージョン履歴 yanked_notice: このバージョンはヤンクされ、直接のダウンロードや依存関係になっている可能性がある他のgemは利用できません。 + archived_notice: show_yanked: not_hosted_notice: このgemは現在RubyGems.org上ではホストされていません。このgemのヤンクされたバージョンはまだ存在する可能性があります。 reserved_namespace_html: @@ -981,3 +982,8 @@ ja: api_key_gem_html: 'gem: %{gem}' api_key_mfa: 'MFA: %{mfa}' not_required: 必要ではありません + archive: + create: + success: + destroy: + success: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 2c41e12c4f2..e38166b8ef5 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -691,6 +691,7 @@ nl: show_all_versions: Toon alle versies (%{count} totaal) versions_header: Versies yanked_notice: + archived_notice: show_yanked: not_hosted_notice: Deze gem wordt momenteel niet gehost op rubygems.org. reserved_namespace_html: @@ -960,3 +961,8 @@ nl: api_key_gem_html: api_key_mfa: not_required: + archive: + create: + success: + destroy: + success: diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 34a5748e8d5..ec67093ab98 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -704,6 +704,7 @@ pt-BR: show_all_versions: Mostrar todas as versões (%{count}) versions_header: Versões yanked_notice: Esta gem foi removida, e não está mais disponível para download. + archived_notice: show_yanked: not_hosted_notice: Esta gem não está hospedada no Gemcutter. reserved_namespace_html: @@ -983,3 +984,8 @@ pt-BR: api_key_gem_html: api_key_mfa: not_required: + archive: + create: + success: + destroy: + success: diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 7bac93b6af7..7b895bd4917 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -699,6 +699,7 @@ zh-CN: show_all_versions: 显示所有版本 (共 %{count} 个) versions_header: 版本列表 yanked_notice: 这个 Gem 版本已经撤回了,无法直接下载,也无法被其他 Gem 依赖。 + archived_notice: show_yanked: not_hosted_notice: 这个 Gem 目前没有被托管在 RubyGems.org 中。这个 Gem 撤回的版本可能已经存在了。 reserved_namespace_html: @@ -974,3 +975,8 @@ zh-CN: api_key_gem_html: api_key_mfa: not_required: + archive: + create: + success: + destroy: + success: diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 3dca89fcae8..78801a4cf32 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -693,6 +693,7 @@ zh-TW: show_all_versions: 顯示所有版本(共 %{count}) versions_header: 版本列表 yanked_notice: 這個 Gem 版本已被移除,因此無法提供下載,也無法被其他的 Gem 相依。 + archived_notice: show_yanked: not_hosted_notice: 這個 Gem 目前沒有在 RubyGems.org 上 reserved_namespace_html: @@ -965,3 +966,8 @@ zh-TW: api_key_gem_html: api_key_mfa: not_required: + archive: + create: + success: + destroy: + success: diff --git a/test/integration/api/v1/archive_test.rb b/test/integration/api/v1/archive_test.rb index 07df528e075..d4ea9f4d14c 100644 --- a/test/integration/api/v1/archive_test.rb +++ b/test/integration/api/v1/archive_test.rb @@ -20,7 +20,7 @@ class Api::V1::ArchiveTest < ActionDispatch::IntegrationTest end should "not archive the gem" do - refute @rubygem.archived? + refute_predicate @rubygem, :archived? end end @@ -66,7 +66,7 @@ class Api::V1::ArchiveTest < ActionDispatch::IntegrationTest end should "unarchive the gem" do - refute @rubygem.archived? + refute_predicate @rubygem, :archived? end should "render a success message" do