mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: logic for can_see_topic?
This commit is contained in:
parent
a4842dd039
commit
6eaaf6714c
@ -59,10 +59,13 @@ module TopicGuardian
|
|||||||
# Deleted topics
|
# Deleted topics
|
||||||
return false if topic.deleted_at && !can_see_deleted_topics?
|
return false if topic.deleted_at && !can_see_deleted_topics?
|
||||||
|
|
||||||
|
if topic.private_message?
|
||||||
|
return authenticated? &&
|
||||||
|
topic.all_allowed_users.where(id: @user.id).exists?
|
||||||
|
end
|
||||||
|
|
||||||
# not secure, or I can see it
|
# not secure, or I can see it
|
||||||
(not(topic.read_restricted_category?) || can_see_category?(topic.category)) &&
|
!topic.read_restricted_category? || can_see_category?(topic.category)
|
||||||
# not private, or I am allowed (or is staff)
|
|
||||||
(not(topic.private_message?) || (authenticated? && (is_admin? || topic.all_allowed_users.where(id: @user.id).exists?)))
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user