diff --git a/app/models/post.rb b/app/models/post.rb index 56278e9c2..bee13f9ac 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -300,7 +300,7 @@ class Post < ApplicationRecord end def autoban - if has_tag?("banned_artist") + if has_tag?("banned_artist") || has_tag?("paid_reward") self.is_banned = true end end diff --git a/test/functional/uploads_controller_test.rb b/test/functional/uploads_controller_test.rb index 1464db180..e5fcc445c 100644 --- a/test/functional/uploads_controller_test.rb +++ b/test/functional/uploads_controller_test.rb @@ -25,6 +25,7 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest assert_equal("completed", upload.status) assert_equal(Post.last, upload.post) assert_equal(upload.post.md5, upload.md5) + upload end context "The uploads controller" do @@ -284,6 +285,20 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest end end + context "when the upload is tagged banned_artist" do + should "autoban the post" do + upload = assert_successful_upload("test/files/test.jpg", tag_string: "banned_artist") + assert_equal(true, upload.post.is_banned?) + end + end + + context "when the upload is tagged paid_reward" do + should "autoban the post" do + upload = assert_successful_upload("test/files/test.jpg", tag_string: "paid_reward") + assert_equal(true, upload.post.is_banned?) + end + end + context "uploading a file from your computer" do should_upload_successfully("test/files/test.jpg") should_upload_successfully("test/files/test.png")