Skip to content

Move Facebook menu notification to Inbox#2340

Merged
ibndawood merged 5 commits intofeature/hosted-woo-updatesfrom
add/2299-facebook-menu-notification-to-inbox
Oct 27, 2022
Merged

Move Facebook menu notification to Inbox#2340
ibndawood merged 5 commits intofeature/hosted-woo-updatesfrom
add/2299-facebook-menu-notification-to-inbox

Conversation

@ibndawood
Copy link
Copy Markdown
Contributor

@ibndawood ibndawood commented Oct 26, 2022

Changes proposed in this Pull Request:

Closes #2299

In this PR:

  1. Adds a class SettingsMoved note that inherits NotesTrait to display the "Facebook menu is moved..." admin message as an inbox note.
  2. Removes "Facebook menu is moved..." admin notice.
  3. Adds a method to WC_Facebookcommerce to access lifecycle_handler that allows us to get the lifecycle of the plugins. This method will return the last event of the lifecycle. The note should be displayed if the previous event is an upgrade and if it happened from v2.1.4.
  • Do the changed files pass phpcs checks? Please remove phpcs:ignore comments in changed files and fix any issues, or delete if not practical.

Screenshots:

image

Detailed test instructions:

  1. Generate the build from this PR by running npm run build
  2. Use local to set up 2 WordPress installations.
  3. In one instance, download v2.1.4 from here: https://downloads.wordpress.org/plugin/facebook-for-woocommerce.2.1.4.zip, and install and activate Facebook for WooCommerce.
  4. After activation, navigate to Plugins > Add New > Upload Plugin and upload the zip file generated from step 1. We are no upgrading from v2.1.4 to the version in the build.
  5. Activate the plugin after the update and navigate to WooCommerce > Home. The Inbox should have a note as shown in the screenshot.
  6. In another instance, install the build from the PR. Verify that no admin notices or inbox notes are added.
  7. Verify the admin notice "Heads up! The Facebook menu is now located under the Marketing menu" is not displayed anywhere.

Additional details:

The Facebook menu was moved under the Marketing menu in the WP admin panel in v2.2.0. This note should be displayed only to users updating the plugin from before v2.2.0.

The Lifecycle handler stores events such as installation and upgrade. It does not record downgrades. It also stores the latest version in the options table using this key: wc_facebook_for_woocommerce_version. This key is not updated on downgrades. Hence, it does not record events such as upgrades if we do them after installing a recent version.

For example, if we install v2.6.28 and then downgrade to v2.1.4, and then upgrade to v2.6.27, the last upgrade will not be recorded. Hence for testing, we need to use 2 separate installations.

Changelog entry

Add - Inbox note about Facebook menu moved under the Marketing menu.

@github-actions github-actions bot added changelog: add A new feature, function, or functionality was added. type: enhancement The issue is a request for an enhancement. labels Oct 26, 2022
@ibndawood ibndawood self-assigned this Oct 26, 2022
@ibndawood ibndawood marked this pull request as ready for review October 26, 2022 05:51
@ibndawood ibndawood requested a review from a team October 26, 2022 05:51
Copy link
Copy Markdown
Contributor

@rawdreeg rawdreeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ibndawood,

I tested this PR, and everything worked as expected. I left a small comment regarding the use of \facebook_for_woocommerce().

Comment thread includes/Admin/Notes/SettingsMoved.php Outdated
Co-authored-by: Rodrigue <rodrigue.tusse@automattic.com>
@ibndawood
Copy link
Copy Markdown
Contributor Author

Thank you @rawdreeg for the review.

@ibndawood ibndawood merged commit 653bc21 into feature/hosted-woo-updates Oct 27, 2022
@ibndawood ibndawood deleted the add/2299-facebook-menu-notification-to-inbox branch October 27, 2022 11:59
@ibndawood ibndawood mentioned this pull request Oct 27, 2022
@ibndawood ibndawood mentioned this pull request Nov 15, 2022
ibndawood added a commit that referenced this pull request Nov 24, 2022
ibndawood added a commit that referenced this pull request Nov 24, 2022
@ibndawood ibndawood mentioned this pull request Nov 24, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: add A new feature, function, or functionality was added. type: enhancement The issue is a request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants