discourse/app/serializers
Bianca Nenciu dcd81d56c0
FIX: category selectors for lazy loaded categories (#24533)
A lot of work has been put in the select kits used for selecting
categories: CategorySelector, CategoryChooser, CategoryDrop, however
they still do not work as expected when these selectors already have
values set, because the category were still looked up in the list of
categories stored on the client-side Categrories.list().

This PR fixes that by looking up the categories when the selector is
initialized. This required altering the /categories/find.json endpoint
to accept a list of IDs that need to be looked up. The API is called
using Category.asyncFindByIds on the client-side.

CategorySelector was also updated to receive a list of category IDs as
attribute, instead of the list of categories, because the list of
categories may have not been loaded.

During this development, I noticed that SiteCategorySerializer did not
serializer all fields (such as permission and notification_level)
which are not a property of category, but a property of the relationship
between users and categories. To make this more efficient, the
preload_user_fields! method was implemented that can be used to
preload these attributes for a user and a list of categories.
2023-12-08 12:01:08 +02:00
..
concerns FEATURE: increase tag description limit to 1000 (#24561) 2023-11-28 08:45:40 +11:00
about_serializer.rb DEV: Ability to collect stats without exposing them via API (#23933) 2023-11-10 00:44:05 +04: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 FIX: Further improvements for plugin list (#24622) 2023-11-30 10:53:17 +10:00
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: Deprecate defunct User#flag_level column (#24134) 2023-10-27 17:27:04 +08: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 FIX: category selectors for lazy loaded categories (#24533) 2023-12-08 12:01:08 +02: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 DEV: Add reviewables tab to the new user menu (#17630) 2022-07-28 11:16:33 +03:00
basic_reviewable_queued_post_serializer.rb DEV: Add reviewables tab to the new user menu (#17630) 2022-07-28 11:16:33 +03:00
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 DEV: Add reviewables tab to the new user menu (#17630) 2022-07-28 11:16:33 +03:00
basic_theme_serializer.rb PERF: Don't serialize value for theme_fields unnecessarily (#21201) 2023-04-24 09:30:51 -05:00
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 DEV: Ensure a broken tag_group relation doesn't raise an error (#16529) 2022-04-21 18:18:35 +01:00
category_serializer.rb FEATURE: Configurable auto-bump cooldown (#20507) 2023-03-10 13:45:01 +08: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 FEATURE: Split navigation preference for count and behavior of sidebar links (#22203) 2023-06-22 19:04:13 +03:00
current_user_serializer.rb DEV: Remove unread_private_messages and deprecation (#22893) 2023-08-01 14:44:39 +10: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 FEATURE: Let users select flair (#13587) 2021-07-08 10:46:21 +03:00
form_template_serializer.rb DEV: Show form templates in the composer (#21190) 2023-05-29 14:47:18 -07:00
found_user_serializer.rb DEV: return user IDs on the user search route (#21206) 2023-04-25 18:25:57 +04:00
found_user_with_status_serializer.rb DEV: return user status on the user search route (#17716) 2022-08-09 14:54:33 +04:00
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
group_user_with_custom_fields_serializer.rb FEATURE: Add custom fields to members on group index (#24232) 2023-11-07 10:06:47 -04: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
inactive_user_serializer.rb FEATURE: Show user cards for inactive users (#21387) 2023-05-15 21:45:26 +03: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 FIX: Hide delete button to invite as user are unable to delete anyway (#21884) 2023-06-06 12:24:19 +08:00
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 FEATURE: Site setting to display user avatars in user menu (#24514) 2023-12-07 11:30:44 -06:00
penalty_counts_serializer.rb
pending_post_serializer.rb FIX: Attribute pending post to author in PendingPostSerialier (#23369) 2023-09-03 22:14:51 +00:00
permalink_serializer.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
post_action_type_serializer.rb PERF: Cache ToS and Privacy Policy paths (#21860) 2023-06-07 21:31:20 +03: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 DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01: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 DEV: Introduce PresenceChannel API for core and plugin use 2021-08-27 16:26:06 +01:00
primary_group_serializer.rb FEATURE: Let users select flair (#13587) 2021-07-08 10:46:21 +03:00
private_message_topic_tracking_state_serializer.rb FEATURE: Display unread and new counts for messages. (#14059) 2021-08-25 11:17:56 +08:00
published_page_serializer.rb
queued_post_serializer.rb DEV: Replace raw comments with deprecation warnings (#22617) 2023-07-18 10:13:40 +08:00
remote_theme_serializer.rb PERF: Don't serialize value for theme_fields unnecessarily (#21201) 2023-04-24 09:30:51 -05:00
reviewable_action_serializer.rb FIX: Don't mix up action labels between different reviewables (#23365) 2023-09-06 10:57:30 +08: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 DEV: Include context question for chat reviewables (#23332) 2023-09-05 10:11:39 +08:00
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: Remove legacy user menu (#21308) 2023-05-17 09:16:42 -07: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: Convert approve_new_topics_unless_trust_level to groups (#24504) 2023-11-22 10:44:59 -07: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: Include context question for chat reviewables (#23332) 2023-09-05 10:11:39 +08: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 DEV: Get headline excerpt config from GroupedSearchResult in serializer. (#20942) 2023-04-03 15:02:42 -03:00
search_result_user_serializer.rb
search_topic_list_item_serializer.rb
sidebar_section_serializer.rb PERF: Strict loading for SidebarSection queries (#21717) 2023-05-25 09:10:32 +08:00
sidebar_tag_serializer.rb UX: Display tag's description as title in navigation menu (#22710) 2023-07-24 08:07:37 +08:00
sidebar_url_serializer.rb FIX: consistent sidebar section external links (#22343) 2023-06-30 12:25:43 +10: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: Try fix category form template flaky (#22461) 2023-07-06 14:42:59 +10:00
site_serializer.rb FEATURE: Site setting to display user avatars in user menu (#24514) 2023-12-07 11:30:44 -06:00
site_text_serializer.rb DEV: Add endpoint for dismissing outdated translations (#22509) 2023-07-19 23:06:13 +08:00
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_field_serializer.rb PERF: Don't serialize value for theme_fields unnecessarily (#21201) 2023-04-24 09:30:51 -05:00
theme_serializer.rb PERF: Don't serialize value for theme_fields unnecessarily (#21201) 2023-04-24 09:30:51 -05: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_category_serializer.rb DEV: Serialize categories in topic lists (#23597) 2023-10-17 19:06:01 +03:00
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 FEATURE: display PM participant group names in the topics list. (#21677) 2023-05-31 19:32:06 +05:30
topic_list_serializer.rb DEV: Serialize categories in topic lists (#23597) 2023-10-17 19:06:01 +03: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 FIX: Show auto-group flair according to user preferences (#21221) 2023-04-24 16:04:26 -03:00
topic_poster_serializer.rb FEATURE: Let users select flair (#13587) 2021-07-08 10:46:21 +03:00
topic_summary_serializer.rb DEV: Remove need for reloading cached summary thanks to Range#max (#23106) 2023-08-15 15:03:42 -03:00
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 PERF: optimise serialization for topic tracking state (#20860) 2023-03-28 18:09:22 +11:00
topic_tracking_state_serializer.rb PERF: optimise serialization for topic tracking state (#20860) 2023-03-28 18:09:22 +11: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 FEATURE: Inline topic summary. Cached version accessible to everyone. (#22551) 2023-07-12 11:21:51 -03: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 FIX: Allow .ics for polymorphic bookmarks (#16694) 2022-05-11 09:29:24 +10:00
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 FEATURE: allow user to override watched_precedence_over_muted setting (#22340) 2023-07-04 15:08:29 +10:00
user_post_bookmark_serializer.rb DEV: Fix Lint/DuplicateMethods (#24746) 2023-12-06 13:18:34 +01:00
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: Rename experimental_passkeys to enable_passkeys (#24349) 2023-11-13 15:04:15 -05:00
user_status_serializer.rb DEV: Format UserStatus#ends_at as a ISO8601 timestamp (#23796) 2023-10-05 20:41:12 +02: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: Refactor watched words (#24163) 2023-11-01 16:41:10 +02:00
watched_word_serializer.rb FIX: Make serialized watched word regex Javascript compatible (#22010) 2023-06-09 10:22:41 +00:00
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 FEATURE: add support for like webhooks (#12917) 2021-04-30 17:08:38 -07:00
web_hook_post_serializer.rb FEATURE: Allow expanding hidden posts for groups in SiteSetting.can_see_hidden_post (#21853) 2023-06-01 11:32:05 +08:00
web_hook_topic_view_serializer.rb FEATURE: Inline topic summary. Cached version accessible to everyone. (#22551) 2023-07-12 11:21:51 -03:00
web_hook_user_serializer.rb FEATURE: Remove support for legacy navigation menu (#23752) 2023-10-09 07:24:10 +08: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 UX: Add Styling step to wizard (#14132) 2021-08-25 17:10:12 -04:00
wizard_step_serializer.rb DEV: Cleanup unused wizard illustrations (#23659) 2023-09-26 10:34:38 +08:00