Skip to content

Commit

Permalink
add endpoint to show form to archive gem
Browse files Browse the repository at this point in the history
  • Loading branch information
colby-swandale committed Aug 19, 2024
1 parent 65e9fd0 commit df83f08
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/controllers/archive_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class ArchiveController < ApplicationController
before_action :find_rubygem
before_action :verify_mfa_requirement

def show
end

def create
authorize @rubygem, :archive?
@rubygem.archive!(current_user)
Expand Down
8 changes: 8 additions & 0 deletions app/helpers/rubygems_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ def rubygem_trusted_publishers_link(rubygem)
link_to t("rubygems.aside.links.trusted_publishers"), rubygem_trusted_publishers_path(rubygem.slug), class: "gem__link t-list__item"
end

def rubygems_archive_link(rubygem)
link_to t("rubges.aside.links.archive"), rubygems_archive_path(rubygem.slug), class: "gem__link t-list__item", method: "post"

Check warning on line 101 in app/helpers/rubygems_helper.rb

View check run for this annotation

Codecov / codecov/patch

app/helpers/rubygems_helper.rb#L101

Added line #L101 was not covered by tests
end

def rubygems_unarchive_link(rubygem)
link_to t("rubges.aside.links.unarchive"), rubygems_archive_path(rubygem.slug), class: "gem__link t-list__item", method: "delete"

Check warning on line 105 in app/helpers/rubygems_helper.rb

View check run for this annotation

Codecov / codecov/patch

app/helpers/rubygems_helper.rb#L105

Added line #L105 was not covered by tests
end

def oidc_api_key_role_links(rubygem)
roles = current_user.oidc_api_key_roles.for_rubygem(rubygem)

Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
resources :adoptions, only: %i[index]
resources :trusted_publishers, controller: 'oidc/rubygem_trusted_publishers', only: %i[index create destroy new]

get 'archive', to: 'archive#show'
post 'archive', to: 'archive#create'
delete 'archive', to: 'archive#destroy'
end
Expand Down

0 comments on commit df83f08

Please sign in to comment.