FIX: Make post notices invisible to poster.

This commit is contained in:
Dan Ungureanu 2019-03-11 12:06:04 +02:00
parent b28b418363
commit ceec11a153
No known key found for this signature in database
GPG Key ID: 0AA2A00D6ACC8B84
2 changed files with 2 additions and 2 deletions

View File

@ -370,7 +370,7 @@ class PostSerializer < BasicPostSerializer
end
def include_post_notice_type?
return false if scope.user&.id != object.user_id && !scope.user&.has_trust_level?(TrustLevel[2])
return false if scope.user&.id == object.user_id || !scope.user&.has_trust_level?(TrustLevel[2])
post_notice_type.present?
end

View File

@ -193,7 +193,7 @@ describe PostSerializer do
it "will not show for poster and TL2+ users" do
expect(json_for_user(nil)[:post_notice_type]).to eq(nil)
expect(json_for_user(user)[:post_notice_type]).to eq("returning")
expect(json_for_user(user)[:post_notice_type]).to eq(nil)
expect(json_for_user(user_tl1)[:post_notice_type]).to eq(nil)
expect(json_for_user(user_tl2)[:post_notice_type]).to eq("returning")
end