artists: fix ban/unban actions.
Fix the ban! and unban! methods to: * Lock the artist while it is being banned or unbanned. * Perform the edits as a mass update, so that the posts are updated in parallel. * Edit the artist as the banner rather than as the current user. * Soft delete the banned_artist implication when an artist is unbanned instead of hard deleting it. * Ignore the banned_artist implication if it's deleted.
This commit is contained in:
@@ -19,13 +19,13 @@ class ArtistsController < ApplicationController
|
||||
|
||||
def ban
|
||||
@artist = authorize Artist.find(params[:id])
|
||||
@artist.ban!(banner: CurrentUser.user)
|
||||
@artist.ban!(CurrentUser.user)
|
||||
redirect_to(artist_path(@artist), :notice => "Artist was banned")
|
||||
end
|
||||
|
||||
def unban
|
||||
@artist = authorize Artist.find(params[:id])
|
||||
@artist.unban!
|
||||
@artist.unban!(CurrentUser.user)
|
||||
redirect_to(artist_path(@artist), :notice => "Artist was unbanned")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user