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

@ -393,14 +393,14 @@ describe TopicQuery do
end
end
context 'already seen categories' do
context 'already seen topics' do
it 'is removed from new and visible on latest lists' do
category = Fabricate(:category_with_definition)
topic = Fabricate(:topic, category: category)
CategoryUser.create!(user_id: user.id,
category_id: category.id,
last_seen_at: topic.created_at
)
DismissedTopicUser.create!(user_id: user.id,
topic_id: topic.id,
created_at: Time.zone.now
)
expect(topic_query.list_new.topics.map(&:id)).not_to include(topic.id)
expect(topic_query.list_latest.topics.map(&:id)).to include(topic.id)
end