From c1725f6dc0fe0a6598b1325a7d6f221eea46a096 Mon Sep 17 00:00:00 2001 From: Albert Yi Date: Tue, 5 Jun 2018 13:16:28 -0700 Subject: [PATCH] eliminate artist undelete action on controller --- app/controllers/artists_controller.rb | 8 -------- app/views/artists/_secondary_links.html.erb | 4 ++-- config/routes.rb | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index c8dd2e92d..102e941f1 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -74,14 +74,6 @@ class ArtistsController < ApplicationController redirect_to(artist_path(@artist), :notice => "Artist deleted") end - def undelete - if !@artist.deletable_by?(CurrentUser.user) - raise User::PrivilegeError - end - @artist.update_attribute(:is_active, true) - redirect_to(artist_path(@artist), :notice => "Artist undeleted") - end - def revert @artist = Artist.find(params[:id]) @version = @artist.versions.find(params[:version_id]) diff --git a/app/views/artists/_secondary_links.html.erb b/app/views/artists/_secondary_links.html.erb index 06014b52b..2d8c20c39 100644 --- a/app/views/artists/_secondary_links.html.erb +++ b/app/views/artists/_secondary_links.html.erb @@ -15,9 +15,9 @@
  • <%= link_to "History", artist_versions_path(:search => {:artist_id => @artist.id}) %>
  • <% if @artist.deletable_by?(CurrentUser.user) %> <% if @artist.is_active? %> -
  • <%= link_to "Delete", artist_path(@artist), :method => :delete, :data => {:confirm => "Are you sure you want to delete this artist?"} %>
  • +
  • <%= link_to "Delete", artist_path(@artist), method: :delete, data: {confirm: "Are you sure you want to delete this artist?"} %>
  • <% else %> -
  • <%= link_to "Undelete", undelete_artist_path(@artist), :method => :post, :data => {:confirm => "Are you sure you want to undelete this artist?"} %>
  • +
  • <%= link_to "Undelete", artist_path(@artist), method: :put, data: {confirm: "Are you sure you want to undelete this artist?", params: {"artist[is_active]" => true}} %>
  • <% end %> <% end %> <% if CurrentUser.is_admin? %> diff --git a/config/routes.rb b/config/routes.rb index bb31bb3ce..3fca106f3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -74,7 +74,6 @@ Rails.application.routes.draw do put :revert put :ban put :unban - post :undelete end collection do get :show_or_new