mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: remove muted categories from suggested
This commit is contained in:
parent
7c83823a95
commit
8c68309b5a
1 changed files with 3 additions and 1 deletions
|
@ -313,7 +313,7 @@ class TopicQuery
|
|||
result
|
||||
end
|
||||
|
||||
def remove_muted_categories(list, user, opts)
|
||||
def remove_muted_categories(list, user, opts=nil)
|
||||
category_id = get_category_id(opts[:exclude]) if opts
|
||||
if user
|
||||
list = list.where("NOT EXISTS(
|
||||
|
@ -352,6 +352,8 @@ class TopicQuery
|
|||
excluded_topic_ids += Category.pluck(:topic_id).compact
|
||||
result = result.where("topics.id NOT IN (?)", excluded_topic_ids) unless excluded_topic_ids.empty?
|
||||
|
||||
result = remove_muted_categories(result, @user)
|
||||
|
||||
# If we are in a category, prefer it for the random results
|
||||
if topic.category_id
|
||||
result = result.order("CASE WHEN topics.category_id = #{topic.category_id.to_i} THEN 0 ELSE 1 END")
|
||||
|
|
Loading…
Reference in a new issue