discourse/app
Blake Erickson fe676f334a
FEATURE: Return subcategories on categories endpoint (#14492)
* FEATURE: Return subcategories on categories endpoint

When using the API subcategories will now be returned nested inside of
each category response under the `subcategory_list` param. We already
return all the subcategory ids under the `subcategory_ids` param, but
you then would have to make multiple separate API calls to fetch each of
those subcategories. This way you can get **ALL** of the categories
along with their subcategories in a single API response.

The UI will not be affected by this change because you need to pass in
the `include_subcategories=true` param in order for subcategories to be
returned.

In a follow up PR I'll add the API scoping for fetching categories so
that a readonly API key can be used for the `/categories.json` endpoint. This
endpoint should be used instead of the `/site.json` endpoint for
fetching a sites categories and subcategories.

* Update PR based on feedback

- Have spec check for specific subcategory
- Move comparison check out of loop
- Only populate subcategory list if option present
- Remove empty array initialization
- Update api spec to allow null response

* More PR updates based on feedback

- Use a category serializer for the subcategory_list
- Don't include the subcategory_list param if empty
- For the spec check for the subcategory by id
- Fix spec to account for param not present when empty
2021-10-05 12:12:31 -06:00
..
assets FIX: Display embeddable host's post to category. (#14517) 2021-10-05 13:59:27 -03:00
controllers FEATURE: Return subcategories on categories endpoint (#14492) 2021-10-05 12:12:31 -06:00
helpers FIX: Offer site_logo_dark_url as an option for dark mode themes (#14361) 2021-09-16 17:47:51 -04:00
jobs DEV: use upload id to save in theme setting instead of URL. (#14341) 2021-09-16 07:58:53 +05:30
mailers UX: suspend forever time period messages (#13776) 2021-07-20 14:42:08 +04:00
models FEATURE: Return subcategories on categories endpoint (#14492) 2021-10-05 12:12:31 -06:00
serializers FEATURE: Return subcategories on categories endpoint (#14492) 2021-10-05 12:12:31 -06:00
services DEV: Add `post_alerter_after_save_post` event (#14388) 2021-09-20 21:18:38 +03:00
views FIX: Support Ruby 3 keyword arguments 2021-10-05 11:25:00 -04:00