mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 08:54: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:
@ -2039,6 +2039,27 @@ RSpec.describe TopicsController do
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
||||
it "can mark sub-categories unread" do
|
||||
# TODO do we want to skip category definition by default in fabricator
|
||||
category = Fabricate(:category, skip_category_definition: true)
|
||||
sub = Fabricate(:category, parent_category_id: category.id, skip_category_definition: true)
|
||||
|
||||
topic.update!(category_id: sub.id)
|
||||
|
||||
post1 = create_post(user: user, topic_id: topic.id)
|
||||
create_post(topic_id: topic.id)
|
||||
|
||||
put "/topics/bulk.json", params: {
|
||||
category_id: category.id,
|
||||
include_subcategories: true,
|
||||
filter: 'unread',
|
||||
operation: { type: 'dismiss_posts' }
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(TopicUser.get(post1.topic, post1.user).last_read_post_number).to eq(2)
|
||||
end
|
||||
|
||||
it "can find unread" do
|
||||
# mark all unread muted
|
||||
put "/topics/bulk.json", params: {
|
||||
|
Reference in New Issue
Block a user