FIX: Exclude muted results when suggested related topics at random. (#11290)
We already do this for new and unread results, but not for randomly suggested topics.
This commit is contained in:
parent
123107c28f
commit
7ad2c2bdd8
|
@ -1085,6 +1085,7 @@ class TopicQuery
|
|||
result = result.where("topics.id NOT IN (?)", excluded_topic_ids) unless excluded_topic_ids.empty?
|
||||
|
||||
result = remove_muted_categories(result, @user)
|
||||
result = remove_muted_topics(result, @user)
|
||||
|
||||
# If we are in a category, prefer it for the random results
|
||||
if topic.category_id
|
||||
|
|
|
@ -967,6 +967,18 @@ describe TopicQuery do
|
|||
expect(topic_query.list_suggested_for(tt).topics.length).to eq(1)
|
||||
end
|
||||
|
||||
it 'removes muted topics' do
|
||||
SiteSetting.suggested_topics_max_days_old = 1365
|
||||
tt = topic
|
||||
TopicNotifier.new(old_topic).mute!(user)
|
||||
clear_cache!
|
||||
|
||||
topics = topic_query.list_suggested_for(tt).topics
|
||||
|
||||
expect(topics.length).to eq(1)
|
||||
expect(topics).not_to include(old_topic)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'with private messages' do
|
||||
|
|
Loading…
Reference in New Issue