mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FIX: When dismissing category inform via MessageBus (#8371)
When category is dismissed, `dismiss_new` message is sent to fronted to clean state. In addition, I noticed that when old dismiss new button is clicked, no message is sent so I decided to kill two birds with one stone.
This commit is contained in:

committed by
GitHub

parent
01e2d5a670
commit
43ddf60cdf
@ -849,20 +849,20 @@ class TopicsController < ApplicationController
|
||||
def reset_new
|
||||
if params[:category_id].present?
|
||||
category_ids = [params[:category_id]]
|
||||
|
||||
if params[:include_subcategories] == 'true'
|
||||
category_ids = category_ids.concat(Category.where(parent_category_id: params[:category_id]).pluck(:id))
|
||||
end
|
||||
|
||||
category_ids.each do |category_id|
|
||||
current_user
|
||||
.category_users
|
||||
.where(category_id: category_id)
|
||||
.first_or_initialize
|
||||
.update!(last_seen_at: Time.zone.now)
|
||||
TopicTrackingState.publish_dismiss_new(current_user.id, category_id)
|
||||
end
|
||||
else
|
||||
current_user.user_stat.update_column(:new_since, Time.now)
|
||||
current_user.user_stat.update_column(:new_since, Time.zone.now)
|
||||
TopicTrackingState.publish_dismiss_new(current_user.id)
|
||||
end
|
||||
render body: nil
|
||||
end
|
||||
|
Reference in New Issue
Block a user