mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
FIX: Don't show suggested messages if private messages are disabled
This commit is contained in:
parent
cb9524c365
commit
17ebfd1715
|
@ -100,7 +100,11 @@ class TopicQuery
|
|||
|
||||
# Return a list of suggested topics for a topic
|
||||
def list_suggested_for(topic)
|
||||
return if topic.private_message? && !@user
|
||||
|
||||
# Don't suggest messages unless we have a user, and private messages are
|
||||
# enabled.
|
||||
return if topic.private_message? &&
|
||||
(@user.blank? || !SiteSetting.enable_private_messages?)
|
||||
|
||||
builder = SuggestedTopicsBuilder.new(topic)
|
||||
|
||||
|
|
|
@ -695,6 +695,10 @@ describe TopicQuery do
|
|||
expect(TopicQuery.new(user).list_suggested_for(pm_to_user).topics.map(&:id)).to(
|
||||
eq([new_pm.id, unread_pm.id, related_by_user_pm.id])
|
||||
)
|
||||
|
||||
SiteSetting.enable_private_messages = false
|
||||
expect(TopicQuery.new(user).list_suggested_for(pm_to_group)).to be_blank
|
||||
expect(TopicQuery.new(user).list_suggested_for(pm_to_user)).to be_blank
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user