[go: up one dir, main page]

Skip to content
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

Merged
merged 4 commits into from
Nov 14, 2024
Merged

Conversation

pmusaraj
Copy link
Contributor
@pmusaraj pmusaraj commented Nov 9, 2024

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.

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,
Copy link
Contributor Author

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.

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
Copy link
Contributor Author

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.

@pmusaraj pmusaraj requested a review from nbianca November 9, 2024 15:57
@@ -32,3 +32,24 @@
expect(category_list).to have_no_new_posts_badge
end
end

describe "Viewing category topic list", type: :system do
Copy link
Contributor

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

Copy link
Contributor
@tgxworld tgxworld left a 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.

pmusaraj and others added 2 commits November 13, 2024 21:19
Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
@pmusaraj
Copy link
Contributor Author

Thanks @tgxworld

@pmusaraj pmusaraj merged commit 9b69185 into main Nov 14, 2024
17 checks passed
@pmusaraj pmusaraj deleted the dismiss-include-subcategory branch November 14, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants