Skip to content

Show Notifications in Admin Bar#29755

Closed
eoigal wants to merge 5 commits into
trunkfrom
add/cookie-checker-iframe
Closed

Show Notifications in Admin Bar#29755
eoigal wants to merge 5 commits into
trunkfrom
add/cookie-checker-iframe

Conversation

@eoigal
Copy link
Copy Markdown
Contributor

@eoigal eoigal commented Mar 28, 2023

This PR is part of a project that has added a dedicated notifications page on Reader.

When a browser doesn't permit third party cookies, the admin bar notifications will not be displayed as they are inside an iframe on another domain, widgets.wp.com.

There is already a check on widgets.wp.com to determine if the browser permits third party cookies. This is available when an iframe loads https://widgets.wp.com/3rd-party-cookie-check/index.html.

The iframe will try to set a cookie, the results of which (either WPCOM:3PC:blocked or WPCOM:3PC:allowed) are posted back to the parent page.

For non-WPCOM simple sites that do not load the Jetpack Masterbar, the default admin bar is loaded. It currently uses the results to hide the notifications completely if it found that the browser did not support third party cookies.

This functionality was added in #25448.

This PR removes the hiding and instead allows the changes in admin-bar-v2.js from D106160-code to handle either rendering the iframed notifications or adding redirect to https://wordpress.com/read/notifications

Proposed changes:

  • Removes javascript that hides the notifications on standard WP admin bar if browser doesn't permit third party cookies

Jetpack product discussion

Project thread can be found at pe7F0s-rZ-p2

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Create a JN site using Jetpack Live Branches below or open this link
  • Connect Jetpack
  • In your browser settings enable All or Third-party cookies, e.g. in Chrome enter this in the address bar chrome://settings/cookies to goto cookies related settings
  • Goto wp-admin of your JN site
  • Confirm that you see the WPCOM notifications button in the admin bar
  • Click on the button
  • Confirm that the notifications load correctly in the iframe
  • Now in your browser settings, Block third-party cookies.
    On firefox;

Screenshot 2023-03-29 at 15 50 55

  • Reload wp-admin of the JN site
  • Confirm that you still see the WPCOM notifications button in the admin bar
  • Confirm that WPCOM notifications button is still visible
  • Click on the button
  • Confirm that you are redirected to https://wordpress.com/read/notifications

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 28, 2023

Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run

bin/jetpack-downloader test jetpack add/cookie-checker-iframe

to get started. More details: p9dueE-5Nn-p2

@github-actions github-actions Bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations labels Mar 28, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 28, 2023

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • 🔴 Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: April 4, 2023.
  • Scheduled code freeze: March 28, 2023.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Mar 28, 2023
@eoigal eoigal added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Mar 29, 2023
@eoigal eoigal changed the title Update Admin bar notifications Show Notifications in Admin Bar Mar 29, 2023
Copy link
Copy Markdown
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This effectively reverts #25448. With the current version of Jetpack, Notifications are hidden when third-party cookies are blocked:

image

With this PR, the notifications appear again, but the panel never loads:

image

cc @manzoorwanijk, who worked on #25448.

Edit: noting that the changes from D106160-code aren't visible for me when testing (most likely cache).

@jeherve jeherve added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. x-site cookies Issues involving third-party cookies and removed [Status] Needs Review This PR is ready for review. labels Mar 29, 2023
@eoigal eoigal added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Mar 29, 2023
@bindlegirl
Copy link
Copy Markdown
Contributor

This isn't quite working for me, and I'm unsure if I'm doing something wrong.

I tested on FF and Chrome. In both cases, when cookies are allowed or blocked, the notifications panel shows up but never loads any messages.

Chrome console:

Screenshot 2023-03-30 at 12 15 08

The only time notifications load is when I disable "enhanced tracking protection" in FF.

@bindlegirl bindlegirl added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Mar 30, 2023
@jeherve
Copy link
Copy Markdown
Member

jeherve commented Mar 30, 2023

It's still not quite working for me either:

Screenshot 2023-03-30 at 14 22 03

@eoigal
Copy link
Copy Markdown
Contributor Author

eoigal commented Mar 31, 2023

Sorry I should have removed the Needs Review label.

I had to revert the admin-bar-v2.js library yesterday as there was a regression on how the notifications panel behaved on Safari browser. The fix for this issue is live however, I'm not sure I want to expose the redirect to Jetpack users just yet.

I'm going to leave this PR on hold until we make a decision on this.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 7, 2023

This PR has been marked as stale. This happened because:

  • It has been inactive in the past 3 months.
  • It hasn’t been labeled `[Pri] BLOCKER`, `[Pri] High`, etc.

No further action is needed. But it's worth checking if this PR has clear testing instructions, is it up to date with trunk, and it is still valid. Feel free to close this PR if you think it's not valid anymore — if you do, please add a brief explanation.

@jeherve
Copy link
Copy Markdown
Member

jeherve commented Jul 7, 2023

Closing this for now because of the lack of activity on this. We can always reopen in the future if needed.

@jeherve jeherve closed this Jul 7, 2023
@github-actions github-actions Bot removed the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ x-site cookies Issues involving third-party cookies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants