FIX: Hide a post's pending flag count from TL4 users. (#13129)
They can't see the review queue, so there's no reason to show a button with the post's pending flag count in the post controls.
This commit is contained in:
parent
a5273b37f7
commit
a5fddd5cdb
|
@ -17,9 +17,15 @@ module TopicGuardian
|
||||||
return false if anonymous? || topic.nil?
|
return false if anonymous? || topic.nil?
|
||||||
return true if is_staff?
|
return true if is_staff?
|
||||||
|
|
||||||
|
is_category_group_moderator?(topic.category)
|
||||||
|
end
|
||||||
|
|
||||||
|
def can_moderate_topic?(topic)
|
||||||
|
return false if anonymous? || topic.nil?
|
||||||
|
return true if is_staff?
|
||||||
|
|
||||||
can_perform_action_available_to_group_moderators?(topic)
|
can_perform_action_available_to_group_moderators?(topic)
|
||||||
end
|
end
|
||||||
alias :can_moderate_topic? :can_review_topic?
|
|
||||||
|
|
||||||
def can_create_shared_draft?
|
def can_create_shared_draft?
|
||||||
SiteSetting.shared_drafts_enabled? && can_see_shared_draft?
|
SiteSetting.shared_drafts_enabled? && can_see_shared_draft?
|
||||||
|
|
|
@ -112,4 +112,13 @@ describe TopicGuardian do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#can_review_topic?' do
|
||||||
|
it 'returns false for TL4 users' do
|
||||||
|
tl4_user = Fabricate(:user, trust_level: TrustLevel[4])
|
||||||
|
topic = Fabricate(:topic)
|
||||||
|
|
||||||
|
expect(Guardian.new(tl4_user).can_review_topic?(topic)).to eq(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue