discourse/spec/models
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
..
about_spec.rb DEV: Ability to collect stats without exposing them via API (#23933) 2023-11-10 00:44:05 +04:00
admin_dashboard_data_spec.rb FEATURE: remove category badge style options, set bullet style as default (#24198) 2023-11-13 10:46:15 -05:00
api_key_scope_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
api_key_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
application_request_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
associated_group_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
badge_grouping_spec.rb DEV: Set limits for text fields on BadgeGrouping 2023-05-15 09:54:54 +02:00
badge_spec.rb FEATURE: reduce avatar sizes to 6 from 20 (#21319) 2023-06-01 10:00:01 +10:00
badge_type_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
bookmark_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
category_featured_topic_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
category_group_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
category_list_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
category_setting_spec.rb FEATURE: Configurable auto-bump cooldown (#20507) 2023-03-10 13:45:01 +08:00
category_spec.rb FIX: category selectors for lazy loaded categories (#24533) 2023-12-08 12:01:08 +02:00
category_tag_stat_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
category_user_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
child_theme_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
color_scheme_color_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
color_scheme_spec.rb FIX: Ensure ColorScheme#resolve falls back to base for missing color (#20186) 2023-02-06 18:24:12 +00:00
developer_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
digest_email_site_setting_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
directory_item_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
discourse_connect_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
do_not_disturb_timing_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
draft_sequence_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
draft_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
email_change_request_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
email_log_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
email_token_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
embeddable_host_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
emoji_spec.rb DEV: Fix various spec linting issues (#24672) 2023-12-04 13:45:19 +01:00
form_template_spec.rb FEATURE: support to initial values for form templates through /new-topic (#23313) 2023-08-29 18:41:33 -03:00
given_daily_like_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
global_setting_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
group_archived_message_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
group_associated_group_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
group_history_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
group_request_spec.rb DEV: Bump the limits on group request text fields 2023-05-24 09:57:46 +02:00
group_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
group_user_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
incoming_link_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
incoming_links_report_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
invite_redeemer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
invite_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
javascript_cache_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
locale_site_setting_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
mailing_list_mode_site_setting_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
notification_spec.rb FEATURE: Site setting to display user avatars in user menu (#24514) 2023-12-07 11:30:44 -06:00
optimized_image_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
permalink_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
plugin_store_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
post_action_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
post_action_type_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
post_analyzer_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
post_detail_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
post_mover_spec.rb FIX: Post moved small action links should respect subfolder installs (#24336) 2023-11-13 11:06:25 +08:00
post_reply_key_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
post_reply_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
post_revision_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
post_spec.rb FIX: with_secure_uploads? could return nil in some cases (#24592) 2023-11-28 13:12:28 +10:00
post_stripper_spec.rb FIX: user got notified about a mention inside a chat message quote (#24229) 2023-11-08 23:13:25 +04:00
post_timing_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
private_message_topic_tracking_state_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
published_page_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
quoted_post_spec.rb DEV: Fix a flaky quote post spec (#22891) 2023-08-01 00:48:40 +02:00
remote_theme_spec.rb FEATURE: Theme settings migrations (#24071) 2023-11-02 08:10:15 +03:00
report_spec.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
reviewable_claimed_topic_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
reviewable_flagged_post_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
reviewable_history_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
reviewable_post_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
reviewable_queued_post_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
reviewable_score_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
reviewable_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
reviewable_user_spec.rb DEV: reviewable_user spec should assert on delete_user_block instead of delete_user (#24692) 2023-12-04 12:44:32 -03:00
s3_region_site_setting_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
screened_email_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
screened_ip_address_spec.rb DEV: find_each in CSV exports (#22573) 2023-08-17 12:33:52 +10:00
screened_url_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
search_log_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
sidebar_section_link_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
sidebar_section_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
sidebar_url_spec.rb FIX: increase sidebar URL limit to 1000 (#23120) 2023-08-17 14:46:24 +10:00
site_setting_spec.rb DEV: Fix various spec linting issues (#24672) 2023-12-04 13:45:19 +01:00
site_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
sitemap_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
skipped_email_log_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
stylesheet_cache_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
tag_group_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
tag_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
tag_user_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
theme_field_spec.rb FIX: Recompile theme translations when fallback data changes (#24371) 2023-11-14 19:53:27 +00:00
theme_modifier_set_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
theme_settings_migration_spec.rb FEATURE: Theme settings migrations (#24071) 2023-11-02 08:10:15 +03:00
theme_spec.rb FEATURE: Theme settings migrations (#24071) 2023-11-02 08:10:15 +03:00
theme_svg_sprite_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
top_menu_item_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
top_topic_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_allowed_user_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_converter_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_embed_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_featured_users_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_group_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_invite_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_link_click_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_link_spec.rb FIX: Request html when fetching inline onebox data (#24674) 2023-12-04 11:36:42 +10:00
topic_list_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_participant_groups_summary_spec.rb FEATURE: display PM participant group names in the topics list. (#21677) 2023-05-31 19:32:06 +05:30
topic_participants_summary_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_posters_summary_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_tag_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_thumbnail_spec.rb DEV: Fix random typos (#22078) 2023-06-13 22:02:21 +02:00
topic_timer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_tracking_state_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_user_spec.rb DEV: update syntax tree to latest (#24623) 2023-11-29 16:38:07 +11:00
topic_view_item_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
translation_override_spec.rb FIX: Don't show admin warnings about deleted translation overrides (#22614) 2023-07-14 16:52:39 +08:00
trust_level_and_staff_setting_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
trust_level_setting_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
trust_level3_requirements_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
unsubscribe_key_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
upload_reference_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
upload_spec.rb FIX: Do not attempt S3 ACL call if secure status did not change (#24785) 2023-12-08 12:58:45 +10:00
user_action_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_api_key_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
user_archived_message_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_associated_group_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_auth_token_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_avatar_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_badge_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_bookmark_list_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_email_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_export_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_field_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
user_history_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_notification_schedule_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_option_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_profile_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_profile_view_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_search_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_second_factor_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_security_key_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_spec.rb DEV: Fix Lint/ShadowedArgument (#24733) 2023-12-06 13:16:10 +01:00
user_stat_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_status_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_summary_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
user_visit_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
username_validator_spec.rb DEV: Make sure max_username_length is within MAX_USERNAME_LENGTH_RANGE (#23104) 2023-08-15 12:12:22 -03:00
watched_word_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
web_crawler_request_spec.rb DEV: stop leaking data into tables during test (#21403) 2023-05-06 07:15:33 +10:00
web_hook_event_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
web_hook_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00