Remove special cases for flagging
Prior to the new review queue there were a couple special cases where posts would be auto hidden: * If a TL3 or above flagged a TL0 post as spam * If a TL4 or above flagged a non-staff, non-TL4 post as spam, inappropriate or off topic. These cases are now removed in favour of the scoring system.
This commit is contained in:
parent
5c897b6d0c
commit
4cd620e36e
|
@ -156,22 +156,9 @@ private
|
|||
return if @post.hidden?
|
||||
return if !@created_by.staff? && @post.user&.staff?
|
||||
|
||||
if @post_action_name == :spam &&
|
||||
@created_by.has_trust_level?(TrustLevel[3]) &&
|
||||
@post.user&.trust_level == TrustLevel[0]
|
||||
@post.hide!(@post_action_type_id, Post.hidden_reasons[:flagged_by_tl3_user])
|
||||
elsif PostActionType.auto_action_flag_types.include?(@post_action_name)
|
||||
if @created_by.has_trust_level?(TrustLevel[4]) &&
|
||||
!@created_by.staff? &&
|
||||
@post.user&.trust_level != TrustLevel[4]
|
||||
|
||||
@post.hide!(@post_action_type_id, Post.hidden_reasons[:flagged_by_tl4_user])
|
||||
else
|
||||
score = ReviewableFlaggedPost.find_by(target: @post)&.score || 0
|
||||
if score >= Reviewable.score_required_to_hide_post
|
||||
@post.hide!(@post_action_type_id)
|
||||
end
|
||||
end
|
||||
score = ReviewableFlaggedPost.find_by(target: @post)&.score || 0
|
||||
if score >= Reviewable.score_required_to_hide_post
|
||||
@post.hide!(@post_action_type_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -609,56 +609,6 @@ describe PostAction do
|
|||
expect(post.hidden).to eq(true)
|
||||
end
|
||||
|
||||
it "hide tl0 posts that are flagged as spam by a tl3 user" do
|
||||
newuser = Fabricate(:newuser)
|
||||
post = create_post(user: newuser)
|
||||
|
||||
Discourse.stubs(:site_contact_user).returns(admin)
|
||||
|
||||
PostActionCreator.spam(Fabricate(:leader), post)
|
||||
|
||||
post.reload
|
||||
|
||||
expect(post.hidden).to eq(true)
|
||||
expect(post.hidden_at).to be_present
|
||||
expect(post.hidden_reason_id).to eq(Post.hidden_reasons[:flagged_by_tl3_user])
|
||||
end
|
||||
|
||||
it "hide non-tl4 posts that are flagged by a tl4 user" do
|
||||
SiteSetting.site_contact_username = admin.username
|
||||
|
||||
tl4_user = Fabricate(:trust_level_4)
|
||||
user = Fabricate(:leader)
|
||||
post = create_post(user: user)
|
||||
|
||||
PostActionCreator.spam(tl4_user, post)
|
||||
|
||||
post.reload
|
||||
|
||||
expect(post.hidden).to be_truthy
|
||||
expect(post.hidden_at).to be_present
|
||||
expect(post.hidden_reason_id).to eq(Post.hidden_reasons[:flagged_by_tl4_user])
|
||||
|
||||
post = create_post(user: user)
|
||||
PostActionCreator.spam(Fabricate(:leader), post)
|
||||
post.reload
|
||||
|
||||
expect(post.hidden).to be_falsey
|
||||
|
||||
post = create_post(user: user)
|
||||
PostActionCreator.spam(Fabricate(:moderator), post)
|
||||
post.reload
|
||||
|
||||
expect(post.hidden).to be_falsey
|
||||
|
||||
user = Fabricate(:trust_level_4)
|
||||
post = create_post(user: user)
|
||||
PostActionCreator.spam(tl4_user, post)
|
||||
post.reload
|
||||
|
||||
expect(post.hidden).to be_falsey
|
||||
end
|
||||
|
||||
it "can flag the topic instead of a post" do
|
||||
post1 = create_post
|
||||
create_post(topic: post1.topic)
|
||||
|
|
Loading…
Reference in New Issue