Add migration status notification on the Friends page#609
Merged
Conversation
97aa784 to
df1d93a
Compare
Contributor
Test this PR in WordPress PlaygroundYou can test this pull request directly in WordPress Playground: This will install and activate the plugin with the changes from this PR. |
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.
df1d93a to
b7554cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
friends_migration_statusoption (non-autoloading) set topendingon upgrade,completedwhen all migrations are done, or a Unix timestamp when dismissedfriends_after_headeron the frontend when migrations are pending, with a dismiss button that suppresses it for 2 daysFriends::has_pending_migrations()as a single cheap gate — only does the full migration check when the option ispendingor the dismiss window has expiredfriends.css, so full notification CSS is now included in each theme file).dashiconssizing selector fromaccordion summaryto.friends-widgetin both theme filesTest plan
/friends/completedcomposer testpasses