mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 00:20:54 +08:00
FIX: mark topics in sub categories as unread when dismissing parent
Previously we would only dismiss the parent category and leave the child categories unread
This commit is contained in:
@ -779,7 +779,17 @@ class TopicsController < ApplicationController
|
||||
elsif params[:filter] == 'unread'
|
||||
tq = TopicQuery.new(current_user)
|
||||
topics = TopicQuery.unread_filter(tq.joined_topic_user, current_user.id, staff: guardian.is_staff?).listable_topics
|
||||
topics = topics.where('category_id = ?', params[:category_id]) if params[:category_id]
|
||||
|
||||
if params[:category_id]
|
||||
if params[:include_subcategories]
|
||||
topics = topics.where(<<~SQL, category_id: params[:category_id])
|
||||
category_id in (select id FROM categories WHERE parent_category_id = :category_id) OR
|
||||
category_id = :category_id
|
||||
SQL
|
||||
else
|
||||
topics = topics.where('category_id = ?', params[:category_id])
|
||||
end
|
||||
end
|
||||
topic_ids = topics.pluck(:id)
|
||||
else
|
||||
raise ActionController::ParameterMissing.new(:topic_ids)
|
||||
|
Reference in New Issue
Block a user