mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 23:38:35 +08:00
dcd81d56c0
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. |
||
---|---|---|
.. | ||
addon | ||
app | ||
config | ||
.npmrc | ||
ember-cli-build.js | ||
index.js | ||
package.json |