mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 06:51:27 +08:00
DEV: Deprecate show_in_ui
argument of the register_stat
API (#28727)
We need to start printing deprecation notices when the `show_in_ui` argument is used because it works only for the old about page which will be removed soon. For the new about page, we've introduced a new API `addAboutPageActivity` which is more flexible than a true/false argument on the server side. Internal topic: t/136551.
This commit is contained in:
@ -1122,9 +1122,24 @@ class Plugin::Instance
|
||||
# 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)
|
||||
# TODO(osama): remove show_in_ui when experimental_redesigned_about_page_groups is removed
|
||||
def register_stat(
|
||||
name,
|
||||
show_in_ui: (
|
||||
not_using_deprecated_arg = true
|
||||
false
|
||||
),
|
||||
expose_via_api: false,
|
||||
&block
|
||||
)
|
||||
if !not_using_deprecated_arg
|
||||
Discourse.deprecate(
|
||||
"`show_in_ui` argument of the `register_stat` API is deprecated. Please use the `addAboutPageActivity` JS API instead if you want your custom stat to be shown on the about page.",
|
||||
since: "3.4.0.beta2",
|
||||
drop_from: "3.5.0.beta1",
|
||||
)
|
||||
end
|
||||
|
||||
# We do not want to register and display the same group multiple times.
|
||||
return if DiscoursePluginRegistry.stats.any? { |stat| stat.name == name }
|
||||
|
||||
|
Reference in New Issue
Block a user