-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Dismiss unread posts in subcategories #29671
Conversation
When a parent category shows topics from subcategories, dismissing should dismiss posts in both parent and subcategories.
@@ -207,7 +207,7 @@ export default class DiscoveryListController extends Controller { | |||
this.bulkSelectHelper.dismissRead(operationType, { | |||
categoryId: this.model.category?.id, | |||
tagName: this.model.tag?.id, | |||
includeSubcategories: this.model.noSubcategories, | |||
includeSubcategories: !this.model.noSubcategories, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a bit counter-intuitive to use this, but I think it's the correct thing to do. When noSubcategories=true
, topics from subcategories aren't listed, so we shouldn't dismiss them. Vice-versa, when it is false, topics from subcategories are shown, so they should be included in the list of topics to dismiss.
spec/system/category_topics_spec.rb
Outdated
describe "Viewing category topic list", type: :system do | ||
let(:topic_list) { PageObjects::Components::TopicList.new } | ||
|
||
context "when parent category has default_list_filter=none" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This spec is not related to the fix. But it is adjacent, and I noticed that we had no spec for the default_list_filter
behaviour.
spec/system/category_topics_spec.rb
Outdated
@@ -32,3 +32,24 @@ | |||
expect(category_list).to have_no_new_posts_badge | |||
end | |||
end | |||
|
|||
describe "Viewing category topic list", type: :system do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is common practice to have multiple top level describe blocks in a single system spec file. Can you see if you can combine it with the one above? Maybe something like:
describe "Viewing category page", type: :system do
describe "when viewing top topics" do
...
end
describe "when viewing a parent category with `default_list_filter` set to `none`"
end
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix and tests looks good to me. Some comments about how we describe system specs but nothing major.
Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
Thanks @tgxworld |
When a parent category shows topics from subcategories, dismissing should dismiss posts in both parent and subcategories.
See meta t/335195 for the original report.