DEV: Allow custom site activity items in the new /about page (#28400)

This commit introduces a new frontend API to add custom items to the "Site activity" section in the new /about page. The new API is called `addAboutPageActivity` and it works along side the `register_stat` serve-side API which serializes the data that the frontend API consumes. More details of how the two APIs work together is in the JSDoc comment above the API function definition.

Internal topic: t/128545/9.
This commit is contained in:
Osama Sayegh
2024-08-20 16:16:05 +03:00
committed by GitHub
parent ccb1861ada
commit db6eff7be9
12 changed files with 223 additions and 2 deletions

View File

@ -1121,6 +1121,9 @@ class Plugin::Instance
# group of stats is shown on the site About page in the Site Statistics
# table. Some stats may be needed purely for reporting purposes and thus
# do not need to be shown in the UI to admins/users.
#
# TODO(osama): deprecate show_in_ui when experimental_redesigned_about_page_groups
# is removed
def register_stat(name, show_in_ui: false, expose_via_api: false, &block)
# We do not want to register and display the same group multiple times.
return if DiscoursePluginRegistry.stats.any? { |stat| stat.name == name }