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:
evazion
2022-11-20 18:33:15 -06:00
parent 01c6d11253
commit 4fd028a5ce
5 changed files with 32 additions and 29 deletions

View File

@@ -384,11 +384,7 @@ class PostTest < ActiveSupport::TestCase
context "with a banned artist" do
setup do
CurrentUser.scoped(FactoryBot.create(:admin_user)) do
@artist = FactoryBot.create(:artist)
@artist.ban!
perform_enqueued_jobs
end
@artist = create(:artist, is_banned: true)
@post = FactoryBot.create(:post, :tag_string => @artist.name)
end