From 97dcfa3d2a7197ed530ed1fbc15b022e18838fdb Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 17 Mar 2014 18:30:26 -0700 Subject: [PATCH] Fixes #1520 --- script/fixes/027_fix_banned_artists.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script/fixes/027_fix_banned_artists.rb b/script/fixes/027_fix_banned_artists.rb index f7d3363fd..13a5e3e27 100644 --- a/script/fixes/027_fix_banned_artists.rb +++ b/script/fixes/027_fix_banned_artists.rb @@ -9,8 +9,13 @@ CurrentUser.ip_addr = "127.0.0.1" CurrentUser.without_safe_mode do Artist.where(:is_banned => true).find_each do |artist| - Post.tag_match(artist.name).where(:is_banned => true, :is_deleted => true).find_each do |post| - unless post.post_flags.any? + Post.tag_match(artist.name).where(:is_banned => false).find_each do |post| + post.ban! + end + + Post.tag_match(artist.name).where(:is_deleted => true).find_each do |post| + reasons = post.flags.map(&:reason) + unless reasons.any? {|x| x =~ /Unapproved in three days/} post.undelete! end end