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:
@@ -132,12 +132,12 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
context "unban action" do
|
||||
should "unban an artist" do
|
||||
as(@admin) { @artist.ban!(banner: @admin) }
|
||||
@artist.ban!(@admin)
|
||||
put_auth unban_artist_path(@artist.id), @admin
|
||||
|
||||
assert_redirected_to(@artist)
|
||||
assert_equal(false, @artist.reload.is_banned?)
|
||||
assert_equal(false, TagImplication.exists?(antecedent_name: @artist.name, consequent_name: "banned_artist"))
|
||||
assert_equal(true, TagImplication.deleted.exists?(antecedent_name: @artist.name, consequent_name: "banned_artist"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user