Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check for non-preview logged in user on account criteria #1347

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

miguelpeixe
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

1200550061930446-as-1207301960751644/f

The user account criteria only checks for the reader.email store item, which is not available for non-reader accounts (admin, editor, author, contributor). This is fine for admins and editors, because we allow prompts to render for preview purposes. For example, the Newspack_Popups::is_user_admin() method is used in the reader registration block so it renders a preview of the block.

For authors and contributors it's not the case, so they end up rendering the prompt because they don't match the criteria, but in a success state, because they don't match Newspack_Popups::is_user_admin() either.

This PR tweaks the criteria to account for "non-preview users".

How to test the changes in this Pull Request:

  1. Make sure you have RAS setup with RAS' default prompts
  2. While in trunk, create a new author user
  3. In a fresh session (fresh localstorage), sign in as the author
  4. Confirm you get the reader registration prompt in a success state
  5. Also confirm in the console that newspack_popups_debug.matchingSegment contains the ID of the "Not registered and not signed up for a newsletter" segment
  6. Check out this branch, clear your localstorage and refresh the page
  7. Confirm you don't get prompt
  8. Confirm newspack_popups_debug.matchingSegment is null

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

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

Works as described, but the logic is a bit hard to read with the multiple negations.

@miguelpeixe miguelpeixe merged commit 9f6f062 into trunk Sep 16, 2024
8 checks passed
@miguelpeixe miguelpeixe deleted the fix/criteria-account-non-preview-user branch September 16, 2024 13:21
matticbot pushed a commit that referenced this pull request Sep 20, 2024
# [3.1.0-alpha.1](v3.0.1...v3.1.0-alpha.1) (2024-09-20)

### Bug Fixes

* check for non-preview logged in user on account criteria ([#1347](#1347)) ([9f6f062](9f6f062))
* prioritize ras overlays for delayed prompts ([21c3091](21c3091))
* prioritize ras overlays for delayed prompts [#1341](#1341)  ([c0027d1](c0027d1))
* verify delayed prompt can still be displayed before showing ([#1344](#1344)) ([235f36b](235f36b))

### Features

* store prompt activation date ([#1340](#1340)) ([2c11424](2c11424))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 3.1.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Oct 8, 2024
# [3.1.0](v3.0.1...v3.1.0) (2024-10-08)

### Bug Fixes

* check for non-preview logged in user on account criteria ([#1347](#1347)) ([9f6f062](9f6f062))
* prioritize ras overlays for delayed prompts ([21c3091](21c3091))
* prioritize ras overlays for delayed prompts [#1341](#1341)  ([c0027d1](c0027d1))
* verify delayed prompt can still be displayed before showing ([#1344](#1344)) ([235f36b](235f36b))

### Features

* store prompt activation date ([#1340](#1340)) ([2c11424](2c11424))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants