artists: allow members to rename, delete, and undelete artists.

Also allow Members to edit deleted or banned artists. Previously this
was limited in the html, but not in the backend.
This commit is contained in:
evazion
2019-12-16 19:38:16 -06:00
parent ddf928515c
commit fff4e3badd
6 changed files with 12 additions and 33 deletions

View File

@@ -1,7 +1,6 @@
class ArtistsController < ApplicationController
respond_to :html, :xml, :json, :js
before_action :member_only, :except => [:index, :show, :show_or_new, :banned]
before_action :builder_only, :only => [:destroy]
before_action :admin_only, :only => [:ban, :unban]
before_action :load_artist, :only => [:ban, :unban, :show, :edit, :update, :destroy, :undelete]
@@ -61,9 +60,6 @@ class ArtistsController < ApplicationController
end
def destroy
if !@artist.deletable_by?(CurrentUser.user)
raise User::PrivilegeError
end
@artist.update_attribute(:is_active, false)
redirect_to(artist_path(@artist), :notice => "Artist deleted")
end
@@ -96,8 +92,7 @@ private
end
def artist_params(context = nil)
permitted_params = %i[name other_names other_names_string group_name url_string notes]
permitted_params << :is_active if CurrentUser.is_builder?
permitted_params = %i[name other_names other_names_string group_name url_string notes is_active]
permitted_params << :source if context == :new
params.fetch(:artist, {}).permit(permitted_params)