discourse/config/initializers
Martin Brennan fb9bb31983
FEATURE: Notify admins of upcoming changes and log events (#37003)
This commit adds several pieces of functionality to help keep admins
in the loop about upcoming changes.

First of all, there is a new initializer on boot that will notify admins
about
newly available upcoming changes, as well as log removed changes and
status movement of existing changes.

* When there is a new upcoming change, we only notify admins about
   it when the status is the `promote_upcoming_changes_on_status` - 1,
   e.g. if `promote_upcoming_changes_on_status` is `beta` then we only
   tell admin about the change once it has reached `alpha`. This means
   we may log the `added` event in one deploy, but only actually notify
   admins in a subsequent deploy.
* We log removed upcoming changes so we can automatically delete old
   site setting data in a future job as needed.

We also now  notify  admins when  upcoming changes are automatically
promoted to enabled based on the site's
`promote_upcoming_changes_on_status`:

<img width="378" height="600" alt="image"
src="https://github.com/user-attachments/assets/4200fbee-9990-4bbc-a378-85946e631e77"
/>

In addition, we now show an indicator in the admin sidebar
if there are new upcoming changes that have been added since
they last visited the upcoming change config page. This data
is stored in a user custom field, because Redis is ephemeral,
and storing in the User table is overkill because 99% of users
are not staff:

<img width="248" height="112" alt="image"
src="https://github.com/user-attachments/assets/4c3d3cf7-ac39-45f8-a2c8-a049cb85b8e9"
/>

Finally, this commit moves both the Track and Promote initializer
logic behind a `DistributedMutex`, we don't want multiple processes
running the same logic here, it needs to be only once.

---------

Co-authored-by: Loïc Guitaut <loic@discourse.org>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2026-01-21 12:45:54 +10:00
..
000-active_record.rb DEV: Add ai_posts_embeddings to ignored tables (#36629) 2025-12-12 12:58:57 +00:00
000-development_reload_warnings.rb DEV: prevent files being watched warning when using devenv (#32690) 2025-05-13 11:09:53 +02:00
000-mini_sql.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
000-pg_connection_patch.rb DEV: Patch ActiveRecord's postgresql adapter .new_client (#33820) 2025-09-18 11:34:37 +08:00
000-post_migration.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
000-trace_pg_connections.rb DEV: Move debugging gem from byebug to debug (#34827) 2025-09-17 10:08:52 -03:00
000-zeitwerk.rb DEV: Add Pitchfork alongside Unicorn (#35370) 2025-10-24 11:08:23 +02:00
001-redis.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
002-freedom_patches.rb DEV: Remove the obsolete sidekiq patch (#37145) 2026-01-19 16:00:06 +01:00
002-rails_failover.rb DEV: Upgrade Rails to version 7.2 2024-11-27 10:48:47 +01:00
004-message_bus.rb DEV: Make changes for docker_manager Pitchfork compatibility (#36456) 2025-12-18 14:22:39 +01:00
005-site_settings.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
006-ensure_login_hint.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
006-mini_profiler.rb DEV: Upgrade the Redis gem to v5.4 2025-03-19 14:34:00 +01:00
008-rack-cors.rb DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
009-omniauth.rb FIX: Don’t store return path in the session 2025-09-19 10:05:20 +02:00
012-web_hook_events.rb Add user_anonymized webhook event (#36208) 2025-11-25 07:43:16 -08:00
014-track-setting-changes.rb FEATURE: add support for "updating" an application on discourse id (#35384) 2025-11-28 13:07:51 +01:00
015-track-upcoming-changes.rb FEATURE: Notify admins of upcoming changes and log events (#37003) 2026-01-21 12:45:54 +10:00
016-promote-upcoming-changes.rb FEATURE: Notify admins of upcoming changes and log events (#37003) 2026-01-21 12:45:54 +10:00
099-anon-cache.rb FEATURE: Add experimental option for strict-dynamic CSP (#25664) 2024-02-16 11:16:54 +00:00
099-drain_pool.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
100-active-support-type-extensions.rb DEV: Add symbol to ActiveModel attribute types (#36420) 2025-12-03 10:57:44 +01:00
100-custom-timezones.rb DEV: maps IST rails timezone to kolkata (#32896) 2025-05-26 08:56:04 +02:00
100-flags.rb DEV: Upgrade Rails to version 7.2 2024-11-27 10:48:47 +01:00
100-i18n.rb FIX: Purge ExtraLocalesController cache correctly for multisite (#32654) 2025-05-08 23:52:45 +01:00
100-logster.rb FEATURE: Automatic promotion of upcoming changes (#36211) 2025-12-08 15:49:34 +10:00
100-oj.rb
100-onebox_options.rb DEV: Add a user agent to all HTTP requests that Discourse makes. (#31555) 2025-03-03 16:32:25 +11:00
100-push-notifications.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
100-quiet_logger.rb DEV: Upgrade Rails to version 7.1 2024-07-04 10:58:21 +02:00
100-regex-timeout.rb DEV: Introduce regex_timeout_seconds global setting (#20774) 2023-03-22 12:01:35 +00:00
100-secret_token.rb
100-session_store.rb DEV: allow developers to use HTTPS if they wish (#26384) 2024-03-27 10:48:04 +11:00
100-sidekiq.rb DEV: Sidekiq failing to start in development environment (#36582) 2025-12-10 09:33:53 +08:00
100-silence_logger.rb DEV: Upgrade Rails to version 7.1 2024-07-04 10:58:21 +02:00
100-strong_parameters.rb
100-verify_config.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
100-wrap_parameters.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
101-lograge.rb DEV: Log HTTP_ACCEPT_LANGUAGE header in Rails logs take 2 (#35827) 2025-11-05 16:08:07 +08:00
102-truncate-logs.rb DEV: Upgrade Rails to version 7.1 2024-07-04 10:58:21 +02:00
200-first_middlewares.rb PERF: Reject anonymous requests with 503 upon aggressive queuing (#36519) 2025-12-18 10:23:42 +08:00
300-perf.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
400-deprecations.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
999-themes.rb DEV: Improve system theme loading (#34954) 2025-09-24 17:56:41 +01:00
assets.rb DEV: Prepare for rename of app/assets/javascripts/ -> frontend/ 2025-10-22 16:24:11 +01:00
filter_parameter_logging.rb DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00