posts: autoban uploads tagged paid_reward.
This commit is contained in:
@@ -300,7 +300,7 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def autoban
|
def autoban
|
||||||
if has_tag?("banned_artist")
|
if has_tag?("banned_artist") || has_tag?("paid_reward")
|
||||||
self.is_banned = true
|
self.is_banned = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_equal("completed", upload.status)
|
assert_equal("completed", upload.status)
|
||||||
assert_equal(Post.last, upload.post)
|
assert_equal(Post.last, upload.post)
|
||||||
assert_equal(upload.post.md5, upload.md5)
|
assert_equal(upload.post.md5, upload.md5)
|
||||||
|
upload
|
||||||
end
|
end
|
||||||
|
|
||||||
context "The uploads controller" do
|
context "The uploads controller" do
|
||||||
@@ -284,6 +285,20 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
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
|
context "uploading a file from your computer" do
|
||||||
should_upload_successfully("test/files/test.jpg")
|
should_upload_successfully("test/files/test.jpg")
|
||||||
should_upload_successfully("test/files/test.png")
|
should_upload_successfully("test/files/test.png")
|
||||||
|
|||||||
Reference in New Issue
Block a user