diff --git a/app/controllers/rubygems_controller.rb b/app/controllers/rubygems_controller.rb
index 82090abf098..3c612aa13c5 100644
--- a/app/controllers/rubygems_controller.rb
+++ b/app/controllers/rubygems_controller.rb
@@ -1,11 +1,9 @@
class RubygemsController < ApplicationController
include LatestVersion
- before_action :redirect_to_root, only: %i[edit update], unless: :signed_in?
- before_action :set_blacklisted_gem, only: %i[show], if: :blacklisted?
- before_action :find_rubygem, only: %i[edit update show], unless: :blacklisted?
- before_action :latest_version, only: %i[show], unless: :blacklisted?
- before_action :find_versioned_links, only: %i[show], unless: :blacklisted?
- before_action :load_gem, only: %i[edit update]
+ before_action :set_blacklisted_gem, only: :show, if: :blacklisted?
+ before_action :find_rubygem, only: :show, unless: :blacklisted?
+ before_action :latest_version, only: :show, unless: :blacklisted?
+ before_action :find_versioned_links, only: :show, unless: :blacklisted?
before_action :set_page, only: :index
def index
@@ -34,30 +32,6 @@ def show
end
end
- def edit
- flash[:warning] = t('.deprecation_message').html_safe # rubocop:disable Rails/OutputSafety
- end
-
- def update
- if @linkset.update(params_linkset)
- redirect_to rubygem_path(@rubygem)
- flash[:success] = "Gem links updated."
- else
- render :edit
- end
- end
-
- protected
-
- def load_gem
- unless @rubygem.owned_by?(current_user)
- flash[:warning] = "You do not have permission to edit this gem."
- redirect_to root_path
- end
-
- @linkset = @rubygem.linkset
- end
-
private
def blacklisted?
@@ -67,8 +41,4 @@ def blacklisted?
def set_blacklisted_gem
@blacklisted_gem = params[:id].downcase
end
-
- def params_linkset
- params.require(:linkset).permit(:code, :docs, :wiki, :mail, :bugs)
- end
end
diff --git a/app/views/rubygems/_aside.html.erb b/app/views/rubygems/_aside.html.erb
index 3ffb197cc59..e7b5bbdf2b8 100644
--- a/app/views/rubygems/_aside.html.erb
+++ b/app/views/rubygems/_aside.html.erb
@@ -63,8 +63,6 @@
- <%= link_to t('edit'), edit_rubygem_path(@rubygem), :class => "gem__link t-list__item", :id => "edit" if @rubygem.owned_by?(current_user) %>
-
<%- @versioned_links.each do |name, link| %>
<%= link_to_page name, link %>
<%- end %>
diff --git a/app/views/rubygems/edit.html.erb b/app/views/rubygems/edit.html.erb
deleted file mode 100644
index 16ac7cadd98..00000000000
--- a/app/views/rubygems/edit.html.erb
+++ /dev/null
@@ -1,31 +0,0 @@
-<% @title = t('.title') %>
-<% @subtitle = t('.subtitle', :gem => @rubygem.name) %>
-
-
-
<%= t '.other_fields_notice' %>
-
-
-<%= error_messages_for :linkset, :object_name => "gem" %>
-<%= form_for @rubygem.linkset, :url => rubygem_path(@rubygem), :method => :put do |form| %>
-
- <%= form.label :code, :class => 'form__label' %>
- <%= form.text_field :code, :class => 'form__input' %>
-
-
- <%= form.label :docs, :class => 'form__label' %>
- <%= form.text_field :docs, :class => 'form__input' %>
-
-
- <%= form.label :wiki, :class => 'form__label' %>
- <%= form.text_field :wiki, :class => 'form__input' %>
-
-
- <%= form.label :mail, :class => 'form__label' %>
- <%= form.text_field :mail, :class => 'form__input' %>
-
-
- <%= form.label :bugs, :class => 'form__label' %>
- <%= form.text_field :bugs, :class => 'form__input' %>
-
- <%= form.submit t('update'), :data => {:disable_with => t('form_disable_with')}, :class => 'form__submit' %>
-<% end %>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index b647b4062a6..30d18b5299a 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -229,11 +229,6 @@ de:
blacklisted_namespace:
dependencies:
header: "%{title} Abhängigkeiten"
- edit:
- other_fields_notice: Alle anderen Felder können nur durch eine gepushte, aktualisierte Version deines Gems bearbeitet werden.
- subtitle: für %{gem}
- title: Bearbeite Links
- deprecation_message:
gem_members:
authors_header: Autoren
owners_header: Besitzer
diff --git a/config/locales/en.yml b/config/locales/en.yml
index cf13578e0c5..db7f7aa0118 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -229,11 +229,6 @@ en:
blacklisted_namespace: This namespace is reserved by rubygems.org.
dependencies:
header: "%{title} Dependencies"
- edit:
- other_fields_notice: All other fields can only be edited by pushing an updated version of your gem.
- subtitle: for %{gem}
- title: Edit links
- deprecation_message: This page has been deprecated. Please use Gem::Specification#metadata to configure these links. (
read more)
gem_members:
authors_header: Authors
owners_header: Owners
diff --git a/config/locales/es.yml b/config/locales/es.yml
index c67a754632e..d3d33a556f4 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -229,11 +229,6 @@ es:
blacklisted_namespace:
dependencies:
header: dependencias de %{title}
- edit:
- other_fields_notice: Los otros campos solo pueden ser editados al envíar una versión nueva de tu gema.
- subtitle: para %{gem}
- title: Editar ligas
- deprecation_message:
gem_members:
authors_header: Autores
owners_header: Administradores
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 880ba71db42..a8fe2bc3486 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -229,11 +229,6 @@ fr:
blacklisted_namespace: Ce nom est réservé par rubygems.org.
dependencies:
header: Dépendances de %{title}
- edit:
- other_fields_notice: Tous les autres champs ne sont modifiables qu'en soumettant une nouvelle version de votre gem.
- subtitle: pour %{gem}
- title: Modifier les liens
- deprecation_message: Cette page est obsolète. Veuillez utiliser Gem::Specification#metadata pour configurer ces liens. (
read more)
gem_members:
authors_header: Auteurs
owners_header: Propriétaires
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 4b79847a353..d4a5b21b9fe 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -229,11 +229,6 @@ nl:
blacklisted_namespace:
dependencies:
header: "%{title} afhankelijkheden"
- edit:
- other_fields_notice: Alle andere velden kunnen alleen gewijzigd worden door een nieuwe versie van de gem te publiceren.
- subtitle: voor %{gem}
- title: Wijzig gem links
- deprecation_message:
gem_members:
authors_header:
owners_header: Eigenaren
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 2c79e62c996..7b4cebb52f1 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -229,11 +229,6 @@ pt-BR:
blacklisted_namespace: This namespace is reserved by rubygems.org.
dependencies:
header:
- edit:
- other_fields_notice: Os outros campos só podem ser editados quando você submeter uma versão atualizada da sua gem.
- subtitle: "%{gem}"
- title: Editar links
- deprecation_message:
gem_members:
authors_header: Autores
owners_header: Donos
diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml
index f6649e30896..44ffeecee22 100644
--- a/config/locales/zh-CN.yml
+++ b/config/locales/zh-CN.yml
@@ -229,11 +229,6 @@ zh-CN:
blacklisted_namespace:
dependencies:
header: "%{title} 依赖关系"
- edit:
- other_fields_notice: 其他字段的信息你只能通过发布一个新版本的 Gem 来修改。
- subtitle: "%{gem}"
- title: 编辑链接
- deprecation_message:
gem_members:
authors_header: 作者
owners_header: 所有者
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 0a4c0df99e6..d7604fe3a60 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -229,11 +229,6 @@ zh-TW:
blacklisted_namespace:
dependencies:
header: "%{title} 相依性套件"
- edit:
- other_fields_notice: 其他設定欄位只能透過發佈一個新版本的 Gem 來修改
- subtitle: "%{gem}"
- title: 編輯連結
- deprecation_message:
gem_members:
authors_header: 作者
owners_header: 擁有者
diff --git a/config/routes.rb b/config/routes.rb
index 686ae5bd0c8..9ca84ecfcdf 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -144,7 +144,7 @@
end
resources :rubygems,
- only: %i[index show edit update],
+ only: %i[index show update],
path: 'gems',
constraints: { id: Patterns::ROUTE_PATTERN, format: /html|atom/ } do
resource :subscription,
diff --git a/test/functional/rubygems_controller_test.rb b/test/functional/rubygems_controller_test.rb
index cda1cc4c68a..040f76ae580 100644
--- a/test/functional/rubygems_controller_test.rb
+++ b/test/functional/rubygems_controller_test.rb
@@ -36,30 +36,6 @@ class RubygemsControllerTest < ActionController::TestCase
end
end
- context "On GET to show for another user's gem" do
- setup do
- @rubygem = create(:rubygem, number: "1.0.0")
- get :show, params: { id: @rubygem.to_param }
- end
-
- should respond_with :success
- should "not render edit link" do
- refute page.has_selector?("a[href='#{edit_rubygem_path(@rubygem)}']")
- end
- end
-
- context "On GET to show for this user's gem" do
- setup do
- @rubygem = create(:rubygem, owners: [@user], number: "1.0.0")
- get :show, params: { id: @rubygem.to_param }
- end
-
- should respond_with :success
- should "render edit link" do
- assert page.has_selector?("a[href='#{edit_rubygem_path(@rubygem)}']")
- end
- end
-
context "On GET to show for a gem that the user is subscribed to" do
setup do
@rubygem = create(:rubygem)
@@ -88,86 +64,6 @@ class RubygemsControllerTest < ActionController::TestCase
refute page.has_content? 'Unsubscribe'
end
end
-
- context "On GET to edit for this user's gem" do
- setup do
- @rubygem = create(:rubygem, owners: [@user], number: "1.0.0")
- get :edit, params: { id: @rubygem.to_param }
- end
-
- should respond_with :success
- should "render form" do
- assert page.has_selector?("form")
- assert page.has_selector?("input#linkset_code")
- assert page.has_selector?("input#linkset_docs")
- assert page.has_selector?("input#linkset_wiki")
- assert page.has_selector?("input#linkset_mail")
- assert page.has_selector?("input#linkset_bugs")
- assert page.has_selector?("input[type='submit']")
- end
- end
-
- context "On GET to edit for another user's gem" do
- setup do
- @other_user = create(:user)
- @rubygem = create(:rubygem, owners: [@other_user], number: "1.0.0")
- get :edit, params: { id: @rubygem.to_param }
- end
- should respond_with :redirect
- should redirect_to('the homepage') { root_path }
- should set_flash.to("You do not have permission to edit this gem.")
- end
-
- context "On PUT to update for this user's gem that is successful" do
- setup do
- @url = "https://github.com/qrush/gemcutter"
- @rubygem = create(:rubygem, owners: [@user], number: "1.0.0")
- put :update,
- params: {
- id: @rubygem.to_param,
- linkset: {
- code: @url,
- docs: 'http://docs.com',
- wiki: 'http://wiki.com',
- mail: 'http://mail.com',
- bugs: 'http://bugs.com'
- }
- }
- end
- should respond_with :redirect
- should redirect_to('the gem') { rubygem_path(@rubygem) }
- should set_flash.to("Gem links updated.")
- should "update source code url" do
- assert_equal @url, Rubygem.last.linkset.code
- end
- should "update documentation rul" do
- assert_equal 'http://docs.com', Rubygem.last.linkset.docs
- end
- should "update wiki url" do
- assert_equal 'http://wiki.com', Rubygem.last.linkset.wiki
- end
- should "update mailing list url" do
- assert_equal 'http://mail.com', Rubygem.last.linkset.mail
- end
- should "update bugtracker url" do
- assert_equal 'http://bugs.com', Rubygem.last.linkset.bugs
- end
- end
-
- context "On PUT to update for this user's gem that fails" do
- setup do
- @rubygem = create(:rubygem, owners: [@user], number: "1.0.0")
- @url = "totally not a url"
- put :update, params: { id: @rubygem.to_param, linkset: { code: @url } }
- end
- should respond_with :success
- should "not update linkset" do
- assert_not_equal @url, Rubygem.last.linkset.code
- end
- should "render error messages" do
- assert page.has_content?("error prohibited")
- end
- end
end
context "On GET to index with no parameters" do
@@ -494,23 +390,5 @@ class RubygemsControllerTest < ActionController::TestCase
refute page.has_selector?("a#unsubscribe")
end
end
-
- context "On GET to edit" do
- setup do
- @rubygem = create(:rubygem)
- get :edit, params: { id: @rubygem.to_param }
- end
- should respond_with :redirect
- should redirect_to('the homepage') { root_path }
- end
-
- context "On PUT to update" do
- setup do
- @rubygem = create(:rubygem)
- put :update, params: { id: @rubygem.to_param, linkset: {} }
- end
- should respond_with :redirect
- should redirect_to('the homepage') { root_path }
- end
end
end