FEATURE: New way to dismiss new topics (#11927)

This is a try to simplify logic around dismiss new topics to have one solution to work in all places - dismiss all-new, dismiss new in a specific category or even in a specific tag.
This commit is contained in:
Krzysztof Kotlarek
2021-02-04 11:27:34 +11:00
committed by GitHub
parent 151193bb11
commit f39e7fe81d
17 changed files with 317 additions and 33 deletions

View File

@ -897,12 +897,8 @@ class TopicsController < ApplicationController
if params[:include_subcategories] == 'true'
category_ids = category_ids.concat(Category.where(parent_category_id: params[:category_id]).pluck(:id))
end
DismissTopics.new(current_user, Topic.where(category_id: category_ids)).perform!
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