discourse/spec
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
..
fabricators DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
fixtures DEV: Fix various spec linting issues (#24672) 2023-12-04 13:45:19 +01:00
helpers DEV: Use Discourse::SYSTEM_USER_ID in fixtures/009_users (#24743) 2023-12-07 09:04:45 +10:00
import_export DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
initializers DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
integration DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
integrity DEV: Modernise highlightjs loading (#24197) 2023-11-10 20:39:48 +00:00
jobs DEV: Use Discourse::SYSTEM_USER_ID in fixtures/009_users (#24743) 2023-12-07 09:04:45 +10:00
lib DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
mailers DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
migrations DEV: Switch over category settings to new table - Part 3 (#20657) 2023-09-12 09:51:49 +08:00
models FIX: category selectors for lazy loaded categories (#24533) 2023-12-08 12:01:08 +02:00
multisite DEV: Add S3 upload system specs using minio (#22975) 2023-08-23 11:18:33 +10:00
requests FIX: category selectors for lazy loaded categories (#24533) 2023-12-08 12:01:08 +02:00
script/import_scripts DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
serializers DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
services DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
support DEV: Set a browser read timeout in capybara (#24757) 2023-12-07 23:46:20 +01:00
system FIX: Form template form error visiblity (#24779) 2023-12-07 12:26:56 -08:00
tasks FIX: Do not attempt S3 ACL call if secure status did not change (#24785) 2023-12-08 12:58:45 +10:00
views FIX: Use subfolder-safe url for category in html view (#24595) 2023-11-28 19:08:14 +08:00
rails_helper.rb DEV: Set a browser read timeout in capybara (#24757) 2023-12-07 23:46:20 +01:00
regenerate_swagger_docs DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
swagger_helper.rb DEV: Bump rswag-specs from 2.11.0 to 2.13.0 (#24654) 2023-12-07 08:16:47 +08:00