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 MPP-4093: ensure data-has-premium always has an explicit string value #5404

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

groovecoder
Copy link
Member

@groovecoder groovecoder commented Feb 28, 2025

This PR fixes #MPP-4093.

Our new createElement call does not implicitly convert booleans. createElement treats true as a boolean attribute, which results in <firefox-private-relay-addon-data data-has-premium ...>. In the add-on code, we don't handle the attribute as a boolean - we treat it as a string, so the empty attribute value returns as falsy, which makes the add-on think the user is not premium when they really are.

How to test:

With dev server

  1. Push this branch to the dev server
  2. Download firefox_relay-2.8.1-dev-server.zip from https://github.com/mozilla/fx-private-relay-add-on/releases/tag/2.8.1
  3. In a new Firefox profile, go to about:debugging and install the firefox_relay-2.8.1-dev-server.zip add-on as described here.
    • The browser should open to the relay add-on "first run" page
  4. Click the sign up/in button
  5. Sign up/in to a premium account
    • Either sign up/in to an account with your @mozilla.com address to get Premium, or go thru the purchase flow on a new account
  6. With the add-on, generate 6 masks
    • Expected result: you CAN create more than 5 masks!

Locally

In this repo:

  1. Check out this branch which includes React 19 and the fix
  2. cd frontend && npm run build
  3. python manage.py collectstatic
  4. python manage.py runserver

In the add-on repo:

  1. Check out 2.8.1 tag
  2. web-ext run -s src/ -f /Applications/Firefox.app/Contents/MacOS/firefox
    • The browser should open to the relay add-on "first run" page
  3. Click the sign up/in button
    • You should be sent to the sign up/in page at 127.0.0.1:8000/accounts/profile
  4. Sign into an account that has premium (note: any @mozilla.com account will have premium)
  5. With the add-on, generate 6 masks
    • Expected result: you CAN create more than 5 masks!
  • l10n changes have been submitted to the l10n repository, if any.
  • I've added a unit test to test for potential regressions of this bug.
  • I've added or updated relevant docs in the docs/ directory.
  • All UI revisions follow the coding standards, and use Protocol / Nebula colors where applicable (see /frontend/src/styles/colors.scss).
  • Commits in this PR are minimal and have descriptive commit messages.

@vpremamozilla
Copy link
Collaborator

i tested on the dev server. works as intended, see attached video
https://github.com/user-attachments/assets/9dfa92d0-2fd9-4457-8554-d1ccfda721ea

@vpremamozilla vpremamozilla self-requested a review March 1, 2025 01: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.

2 participants