discourse/app/assets/javascripts/select-kit
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
..
addon FIX: category selectors for lazy loaded categories (#24533) 2023-12-08 12:01:08 +02:00
app Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse"" 2020-05-23 00:56:13 -04:00
config DEV: Update ember-cli to 5.0.0 (#22280) 2023-06-26 17:15:59 +02:00
.npmrc DEV: Prevent npm usage (#13945) 2021-08-04 22:04:58 +02:00
ember-cli-build.js DEV: Update ember-cli to 4.12.0 (#21074) 2023-04-19 12:58:29 +02:00
index.js REFACTOR: Support bundling our admin section as an ember addon 2020-09-22 15:14:29 -04:00
package.json Build(deps): Bump the babel group in /app/assets/javascripts with 2 updates (#24637) 2023-11-29 22:29:41 +01:00