Skip to content

Add migration status notification on the Friends page#609

Merged
akirk merged 2 commits into
mainfrom
add/migration-notification
Mar 25, 2026
Merged

Add migration status notification on the Friends page#609
akirk merged 2 commits into
mainfrom
add/migration-notification

Conversation

@akirk

@akirk akirk commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a friends_migration_status option (non-autoloading) set to pending on upgrade, completed when all migrations are done, or a Unix timestamp when dismissed
  • Shows a "Welcome to Friends 4.0" banner via friends_after_header on the frontend when migrations are pending, with a dismiss button that suppresses it for 2 days
  • Adds Friends::has_pending_migrations() as a single cheap gate — only does the full migration check when the option is pending or the dismiss window has expired
  • Adds unit tests covering all notification states and upgrade scenarios
  • Fixes notification styling for mastodon and google-reader themes (those themes don't load friends.css, so full notification CSS is now included in each theme file)
  • Consolidates .dashicons sizing selector from accordion summary to .friends-widget in both theme files

Test plan

  • Upgrade from a 3.x install: notification appears on /friends/
  • Click Dismiss: notification disappears; reappears after 2 days (or manually set the option to a timestamp >2 days ago)
  • All migrations complete: notification stops showing, option set to completed
  • Fresh install: no notification shown
  • Notification renders correctly in default, mastodon, and google-reader themes
  • composer test passes

@akirk akirk force-pushed the add/migration-notification branch from 97aa784 to df1d93a Compare March 25, 2026 10:41
@github-actions

github-actions Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Test this PR in WordPress Playground

You can test this pull request directly in WordPress Playground:

Launch WordPress Playground

This will install and activate the plugin with the changes from this PR.

akirk added 2 commits March 25, 2026 12:10
Introduces a friends_migration_status option (non-autoloading) that
acts as a single gate for both the migration system and the frontend
notification:

- upgrade_plugin() sets it to 'pending' when upgrading from < 4.0.0
  leaves batched migrations unfinished, or 'completed' if everything
  ran synchronously
- Friends::has_pending_migrations() reads the option first; only loads
  the Migration class and checks individual status options when the
  option is not 'completed' or a recent dismiss timestamp
- Migration::has_pending_tracked_migrations() flips the option to
  'completed' once all tracked migrations finish, so subsequent page
  loads cost a single get_option() call
- Frontend shows a welcome-to-4.0 banner via friends_after_header when
  has_pending_migrations() returns true; a dismiss button stores the
  current timestamp so the notice re-appears after 2 days if migrations
  are still pending

Adds 9 unit tests covering all option states and the upgrade_plugin()
behavior for fresh installs, upgrades from < 4.0.0, and bugfix
releases.
Add full notification styles to mastodon.css and google-reader.css
(friends.css is only loaded for the default theme). Also fix dashicons
selector from accordion summary to .friends-widget in both theme files.
@akirk akirk force-pushed the add/migration-notification branch from df1d93a to b7554cf Compare March 25, 2026 11:11
@akirk akirk merged commit 7305755 into main Mar 25, 2026
25 checks passed
@akirk akirk deleted the add/migration-notification branch March 25, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant