0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-14 13:58:53 +08:00
discourse/config/initializers/015-track-upcoming-change-toggle.rb
Martin Brennan 1cb6d36fef
FEATURE: Merge permanent upcoming changes with new features feed (#38526)
Instead of showing new feature feed items in the main list for admins,
we are going to show them in the "what's new" page, because then all
admins
even admins that haven't noticed the item being automatically enabled
will see them.

In addition, a linked PR for the new features feed plugin will
allow admins to override details for permanent upcoming changes,
or show them in different websites like releases.discourse.org 

* Merge new feature feed items with permanent upcoming changes,
taking into account if the items are already linked to an upcoming
change
* If a new feature feed item is linked to an upcoming change, but the
   site doesn't have that upcoming change or it's not in the permanent
   status, then exclude it from the new features feed
* Add filter option to UpcomingChanges::List to filter by specific
  status
* Add option to return the actual file path of the upcoming change
  image so a file reference can be created and an upload can be made
  from that
* Cache current status + datetime the status changed for every
   upcoming change, as well as all permanent upcoming changes,
   keyed to the git version

---------

Co-authored-by: Régis Hanol <regis@hanol.fr>
2026-03-25 07:52:31 +10:00

25 lines
1 KiB
Ruby
Vendored

# frozen_string_literal: true
Rails.application.config.after_initialize { UpcomingChanges.clear_caches! }
#
# Similar to 014-track-setting-changes.rb, we can react to upcoming changes
# being enabled/or disabled here for more complicated scenarios, where
# we are not just changing UI or behaviour when the state of the underlying
# setting is changed.
#
# We need to do this separately from 014-track-setting-changes.rb because
# we don't actually change the underlying setting value in the database
# when an upcoming change is automatically promoted. See UpcomingChanges::NotifyPromotions
# for further context.
#
# We do also send these events when admins manually opt-in or opt-out of an upcoming change
# via the UI and the UpcomingChanges::Toggle service.
DiscourseEvent.on(:upcoming_change_enabled) do |setting_name|
# Respond to event here, e.g. if setting_name == :enable_form_templates do X.
end
DiscourseEvent.on(:upcoming_change_disabled) do |setting_name|
# Respond to event here, e.g. if setting_name == :enable_form_templates do X.
end