* All users can now view deleted posts.

* Posts now have an is_banned flag for artist removal requests.  Basic users can not view banned posts but gold and higher can.
* Banning an artist both deletes the post and bans it.
* By default deleted posts are not filtered out of post searches at the sql level.
This commit is contained in:
albert
2013-03-22 09:38:53 -07:00
parent 733fa2dd7b
commit 6c54d89a36
9 changed files with 40 additions and 8 deletions

View File

@@ -6,5 +6,8 @@ class RemoveUpScoreFromPosts < ActiveRecord::Migration
end
def down
execute "set statement_timeout = 0"
add_column :posts, :up_score, :integer
add_column :posts, :up_score, :integer
end
end

View File

@@ -0,0 +1,14 @@
class AddIsBannedToPosts < ActiveRecord::Migration
def up
execute("set statement_timeout = 0")
add_column :posts, :is_banned, :boolean, :null => false, :default => false
Artist.banned.each do |artist|
Post.raw_tag_match(artist.name).each do |post|
post.update_column(:is_banned, true)
end
end
PostFlag.where("reason ilike '%requested%' and reason <> 'Artist requested removal'").each do |flag|
flag.post.update_column(:is_banned, true)
end
end
end

View File

@@ -2280,7 +2280,8 @@ CREATE TABLE posts (
image_width integer NOT NULL,
image_height integer NOT NULL,
parent_id integer,
has_children boolean DEFAULT false NOT NULL
has_children boolean DEFAULT false NOT NULL,
is_banned boolean DEFAULT false NOT NULL
);
@@ -6263,4 +6264,6 @@ INSERT INTO schema_migrations (version) VALUES ('20130318231740');
INSERT INTO schema_migrations (version) VALUES ('20130320070700');
INSERT INTO schema_migrations (version) VALUES ('20130321144736');
INSERT INTO schema_migrations (version) VALUES ('20130321144736');
INSERT INTO schema_migrations (version) VALUES ('20130322162059');