discourse/spec
Martin Brennan 098ab29d41
FEATURE: Add plugin API to register About stat group (#17442)
This commit introduces a new plugin API to register
a group of stats that will be included in about.json
and also conditionally in the site about UI at /about.

The usage is like this:

```ruby
register_about_stat_group("chat_messages", show_in_ui: true) do
  {
    last_day: 1,
    "7_days" => 10,
    "30_days" => 100,
    count: 1000,
    previous_30_days: 120
  }
end
```

In reality the stats will be generated any way the implementer
chooses within the plugin. The `last_day`, `7_days`, `30_days,` and `count`
keys must be present but apart from that additional stats may be added.
Only those core 4 stat keys will be shown in the UI, but everything will be shown
in about.json.

The stat group name is used to prefix the stats in about.json like so:

```json
"chat_messages_last_day": 2322,
"chat_messages_7_days": 2322,
"chat_messages_30_days": 2322,
"chat_messages_count": 2322,
```

The `show_in_ui` option (default false) is used to determine whether the
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. An extension to the Site
serializer, `displayed_about_plugin_stat_groups`, has been added so this
can be inspected on the client-side.
2022-07-15 13:16:00 +10:00
..
fabricators FEATURE: Decouple category/tag presence in sidebar from notifi level (#17273) 2022-06-30 14:54:20 +08:00
fixtures FIX: Missing translation when translation override contained a `%{key}` (#16625) 2022-05-04 17:35:22 +02:00
helpers DEV: Remove ember-cli flags from the backend (#17147) 2022-06-20 16:33:05 +02:00
import_export DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
initializers DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
integration DEV: Cleanup topic thumbnail enqueuing (#17119) 2022-06-17 11:07:32 +01:00
integrity DEV: Upgrade to Rails 7 2022-04-28 11:51:03 +02:00
jobs FIX: Ensure pull-hotlinked can rewrite lone oneboxes (#17354) 2022-07-06 11:46:33 +01:00
lib FEATURE: Add plugin API to register About stat group (#17442) 2022-07-15 13:16:00 +10:00
mailers FIX: respect user timezone in emails about silencing and suspending (#16918) 2022-05-27 13:58:54 +04:00
models FEATURE: Add plugin API to register About stat group (#17442) 2022-07-15 13:16:00 +10:00
multisite DEV: Run some specs with fake S3 implementation instead of stubs 2022-06-28 21:27:52 +02:00
requests FEATURE: Add plugin API to register About stat group (#17442) 2022-07-15 13:16:00 +10:00
script/import_scripts FEATURE: Promote polymorphic bookmarks to default and migrate (#16729) 2022-05-23 10:07:15 +10:00
serializers FIX: Improve reliability of topic tracking state (#17387) 2022-07-14 13:44:58 +08:00
services DEV: Run some specs with fake S3 implementation instead of stubs 2022-06-28 21:27:52 +02:00
support DEV: Run some specs with fake S3 implementation instead of stubs 2022-06-28 21:27:52 +02:00
tasks FEATURE: Create upload_references table (#16146) 2022-06-09 09:24:30 +10:00
views DEV: Upgrade to Rails 7 2022-04-28 11:51:03 +02:00
rails_helper.rb DEV: Apply Rails 6.1 defaults 2022-05-24 17:13:44 +02: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: Fix openapi definition logo URL (#17038) 2022-06-08 13:10:20 +01:00