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: Can't dismiss unread posts in topics of a sub-subcategory #22870

Conversation

tgxworld
Copy link
Contributor

This is a similar fix to 32d4810

Why this change?

Prior to this change, there is a bug in TopicsController#bulk
where it does not dismiss new unred posts in sub-subcategories when the
category_id and include_subcategories=true params are present. This
is because the controller did not account for sub-subcategories when
fetching the category ids of the new topics that should be dismissed.

This commit fixes the problem by relying on the Category.subcategory_ids class
method which accounts for sub-subcategories.

This is a similar fix to 32d4810

Why this change?

Prior to this change, there is a bug in `TopicsController#bulk`
where it does not dismiss new unred posts in sub-subcategories when the
`category_id` and `include_subcategories=true` params are present. This
is because the controller did not account for sub-subcategories when
fetching the category ids of the new topics that should be dismissed.

This commit fixes the problem by relying on the `Category.subcategory_ids` class
method which accounts for sub-subcategories.
end
category_ids =
if params[:include_subcategories]
Category.subcategory_ids(params[:category_id].to_i)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh just to confirm Category.subcategory_ids(params[:category_id].to_i) returns sub sub categories for a category?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup it returns an array which contains the category id passed to the method as well as the ids of the sub-category and sub-sub-categories for the given category id.

Copy link
Contributor

@nattsw nattsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok locally!

@tgxworld tgxworld merged commit fff578f into discourse:main Jul 31, 2023
13 checks passed
@tgxworld
Copy link
Contributor Author

Thank you for the review @nattsw

@tgxworld tgxworld deleted the fix_cant_dismiss_unread_for_sub_subcategories branch July 31, 2023 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants