discourse/app/serializers
Alan Guo Xiang Tan e3977f84a3
FIX: Incorrect topic tracking state count when a new category is created (#20506)
What is the problem?

We have a hidden site setting `show_category_definitions_in_topic_lists`
which is set to false by default. What this means is that category
definition topics are not shown in the topic list by default. Only the
category definition topic for the category being viewed will be shown.
However, we have a bug where we would show that a category has new
topics when a new child category along with its category definition
topic is created even though the topic list does not list the child
category's category definition topic.

What is the fix here?

This commit fixes the problem by shipping down an additional
`is_category_topic` attribute in `TopicTrackingStateItemSerializer` when
the `show_category_definitions_in_topic_lists` site setting has been set
to false. With the new attribute, we can then exclude counting child
categories' category definition topics when counting new and unread
counts for a category.
2023-03-06 10:13:10 +08:00
..
concerns DEV: Change `enable_sidebar` query param to `navigation_menu` (#20368) 2023-02-21 09:59:56 +08:00
about_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
admin_badge_serializer.rb
admin_badges_serializer.rb
admin_detailed_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
admin_email_template_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
admin_form_template_serializer.rb DEV: Create form templates (#20189) 2023-02-08 11:21:39 -08:00
admin_plugin_serializer.rb
admin_user_action_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
admin_user_list_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
admin_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
admin_web_hook_event_serializer.rb
admin_web_hook_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
api_key_scope_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
api_key_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
application_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
archetype_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
associated_group_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
auth_provider_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
backup_file_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
badge_grouping_serializer.rb
badge_index_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
badge_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
badge_type_serializer.rb
basic_category_serializer.rb DEV: Move `form_template_ids` serializer location (#20446) 2023-02-28 09:09:20 -08:00
basic_group_history_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
basic_group_serializer.rb FEATURE: Allow group owners promote more owners (#19768) 2023-01-11 16:43:18 +08:00
basic_group_user_serializer.rb
basic_post_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
basic_reviewable_flagged_post_serializer.rb
basic_reviewable_queued_post_serializer.rb
basic_reviewable_serializer.rb DEV: Include pending reviewables in the main tab in the user menu (#18471) 2022-10-05 12:30:02 +03:00
basic_reviewable_user_serializer.rb
basic_topic_serializer.rb
basic_user_badge_serializer.rb
basic_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
basic_user_with_status_serializer.rb DEV: move BasicUserWithStatusSerializer from Discourse Chat (#18745) 2022-10-26 16:41:31 +04:00
category_and_topic_lists_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
category_detailed_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
category_group_serializer.rb
category_list_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
category_required_tag_group_serializer.rb
category_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
category_upload_serializer.rb
color_scheme_color_serializer.rb
color_scheme_selectable_serializer.rb
color_scheme_serializer.rb FIX: Allow non-persisted color-scheme colors to be edited (#20104) 2023-01-31 17:10:32 +00:00
current_user_option_serializer.rb DEV: Do not include method definitions in serializer `attributes` 2023-01-09 14:15:00 +00:00
current_user_serializer.rb PERF: Eager load linkables when loading custom sidebar sections (#20490) 2023-03-01 07:39:35 +08:00
detailed_tag_serializer.rb SECURITY: Default tags to show count of topics in unrestricted categories (#19916) 2023-01-20 09:50:24 +08:00
detailed_user_badge_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
directory_column_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
directory_item_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
discourse_version_check_serializer.rb
draft_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
edit_directory_column_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
email_log_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
email_style_serializer.rb
embeddable_host_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
embedding_serializer.rb
emoji_serializer.rb
flagged_topic_serializer.rb
flagged_topic_summary_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
flagged_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
flair_group_serializer.rb
found_user_serializer.rb
found_user_with_status_serializer.rb
gap_serializer.rb
group_post_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
group_post_user_serializer.rb
group_requester_serializer.rb
group_show_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
group_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
grouped_screened_url_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
grouped_search_result_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
hidden_profile_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
incoming_email_details_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
incoming_email_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
invite_link_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
invite_serializer.rb
invited_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
invited_user_record_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
invited_user_serializer.rb
listable_topic_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
new_post_result_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
notification_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
penalty_counts_serializer.rb
pending_post_serializer.rb
permalink_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
post_action_type_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
post_action_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
post_item_excerpt.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
post_revision_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
post_serializer.rb PERF: Don't parse posts for mentions when user status is disabled (#19915) 2023-01-20 07:58:00 +08:00
post_stream_serializer_mixin.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
post_wordpress_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
poster_serializer.rb
presence_channel_state_serializer.rb
primary_group_serializer.rb
private_message_topic_tracking_state_serializer.rb
published_page_serializer.rb
queued_post_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_action_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_bundled_action_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_conversation_post_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_conversation_serializer.rb
reviewable_editable_field_serializer.rb
reviewable_explanation_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_flagged_post_serializer.rb
reviewable_history_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_perform_result_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_post_serializer.rb
reviewable_queued_post_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_score_explanation_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_score_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_score_type_serializer.rb UX/DEV: Review queue redesign fixes (#20239) 2023-03-02 16:40:53 +01:00
reviewable_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_settings_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_topic_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
reviewable_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
screened_email_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
screened_ip_address_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
screened_url_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
search_logs_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
search_post_serializer.rb
search_result_user_serializer.rb
search_topic_list_item_serializer.rb
sidebar_section_serializer.rb DEV: configurable public sidebar sections (#20303) 2023-02-22 08:55:44 +11:00
similar_admin_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
similar_topic_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
single_sign_on_record_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
site_category_serializer.rb DEV: Move `form_template_ids` serializer location (#20446) 2023-02-28 09:09:20 -08:00
site_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
site_text_serializer.rb
skipped_email_log_serializer.rb
suggested_topic_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
suggested_topics_mixin.rb DEV: Replace #pluck_first freedom patch with AR #pick in core (#19893) 2023-02-13 12:39:45 +08:00
tag_group_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
tag_serializer.rb SECURITY: Default tags to show count of topics in unrestricted categories (#19916) 2023-01-20 09:50:24 +08:00
theme_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
theme_settings_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
theme_translation_serializer.rb
topic_embed_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
topic_flag_type_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
topic_link_serializer.rb DEV: Do not include method definitions in serializer `attributes` 2023-01-09 14:15:00 +00:00
topic_list_item_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
topic_list_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
topic_pending_post_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
topic_post_count_serializer.rb DEV: Do not include method definitions in serializer `attributes` 2023-01-09 14:15:00 +00:00
topic_poster_serializer.rb
topic_timer_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
topic_tracking_state_item_serializer.rb FIX: Incorrect topic tracking state count when a new category is created (#20506) 2023-03-06 10:13:10 +08:00
topic_tracking_state_serializer.rb DEV: Improve MessageBus subscriptions for TopicTrackingState (#19767) 2023-02-01 07:18:45 +08:00
topic_view_details_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
topic_view_posts_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
topic_view_serializer.rb DEV: Replace #pluck_first freedom patch with AR #pick in core (#19893) 2023-02-13 12:39:45 +08:00
topic_view_wordpress_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
trust_level3_requirements_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
upload_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
user_action_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
user_auth_token_serializer.rb
user_badge_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
user_badges_serializer.rb
user_bookmark_base_serializer.rb
user_bookmark_list_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
user_card_serializer.rb DEV: Prefer \A and \z over ^ and $ in regexes (#19936) 2023-01-20 12:52:49 -06:00
user_field_serializer.rb
user_history_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
user_name_serializer.rb
user_option_serializer.rb DEV: Do not include method definitions in serializer `attributes` 2023-01-09 14:15:00 +00:00
user_post_bookmark_serializer.rb
user_post_topic_bookmark_base_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
user_serializer.rb DEV: Do not include method definitions in serializer `attributes` 2023-01-09 14:15:00 +00:00
user_status_serializer.rb DEV: start glimmer-ification and optimisations of chat plugin (#19531) 2022-12-21 13:21:02 +01:00
user_summary_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
user_tag_notifications_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
user_topic_bookmark_serializer.rb PERF: Rely on preload for first_post for TopicBookmarkable (#18066) 2022-08-24 16:01:29 +10:00
user_with_custom_fields_serializer.rb
user_wordpress_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
watched_word_list_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
watched_word_serializer.rb
web_hook_category_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
web_hook_flag_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
web_hook_group_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
web_hook_group_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
web_hook_like_serializer.rb
web_hook_post_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
web_hook_topic_view_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
web_hook_user_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
wizard_field_choice_serializer.rb
wizard_field_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00
wizard_serializer.rb
wizard_step_serializer.rb DEV: Apply syntax_tree formatting to `app/*` 2023-01-09 14:14:59 +00:00