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

@ -563,7 +563,7 @@ describe TopicTrackingState do
end
end
it "correctly handles seen categories" do
it "correctly handles dismissed topics" do
freeze_time 1.minute.ago
user = Fabricate(:user)
post
@ -571,6 +571,7 @@ describe TopicTrackingState do
report = TopicTrackingState.report(user)
expect(report.length).to eq(1)
DismissedTopicUser.create!(user_id: user.id, topic_id: post.topic_id, created_at: Time.zone.now)
CategoryUser.create!(user_id: user.id,
notification_level: CategoryUser.notification_levels[:regular],
category_id: post.topic.category_id,
@ -579,12 +580,6 @@ describe TopicTrackingState do
report = TopicTrackingState.report(user)
expect(report.length).to eq(0)
unfreeze_time
post.topic.touch(:created_at)
report = TopicTrackingState.report(user)
expect(report.length).to eq(1)
end
it "correctly handles capping" do