mirror of
https://github.com/discourse/discourse.git
synced 2026-08-04 10:39:43 +08:00
For upcoming changes, we were having a problem where we
were notifying admins of upcoming changes in brand new sites.
A previous fix 2e5afb46e2f5c0547bc298b2bd1a9c39e813dc17 tried
to remedy this, but since it relies on the `new_site?` method, which
isn't true after 1 hour, the next time the scheduled notifications are
run for an admin they will be sent them even if their site is relatively
new.
This commit attempts to conclusively fix the issue by inserting
upcoming change `admins_notified_automatic_promotion` and
`admins_notified_available_change` events via `BackfillNotifiedEvents`
for changes that exist in particular statuses when the site is first
created. These events will have `event_data: {"backfilled" => true}`
to distinguish them from others.
It also fixes an adjacent issue where an admin was notified of a
plugin's upcoming changes as soon as they enable the plugin,
which isn't useful as the intent of upcoming changes is to notify
of changes for things the admin has already been using.
**Before this change, on brand new site with current upcoming change
state**
<img width="401" height="429" alt="image"
src="https://github.com/user-attachments/assets/a89cd641-59aa-4c48-a57c-9692021df176"
/>
**After this change**
No notification to show :) But when I moved an upcoming change to `beta`
it showed
the notification for the enabled upcoming change correctly:
<img width="378" height="174" alt="image"
src="https://github.com/user-attachments/assets/20e4096f-e83f-4c06-970d-a9b43561b12e"
/>
|
||
|---|---|---|
| .. | ||
| backfill_nested_reply_stats_spec.rb | ||
| check_upcoming_changes_spec.rb | ||
| directory_refresh_spec.rb | ||
| maintain_category_activity_daily_rollups_spec.rb | ||
| maintain_user_visit_daily_rollups_spec.rb | ||
| notify_admins_of_available_upcoming_changes_spec.rb | ||
| notify_admins_of_problems_spec.rb | ||
| rebuild_category_activity_daily_rollups_spec.rb | ||
| recalculate_nested_hot_scores_spec.rb | ||