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

Promo code is never claimed if user closes browser too soon #724

Merged
merged 1 commit into from
Oct 24, 2018

Conversation

emerick
Copy link
Contributor

@emerick emerick commented Oct 24, 2018

Fixes brave/brave-browser#1811

We previously only looked for the promoCode file on first
run. However, since there's a short delay before we launch the task to
read the promoCode file, there's a window of opportunity for a user to
close the browser before we read the file. This puts the user in a
state where the first run has occurred but the promoCode file wasn't
read (and therefore won't ever be read).

We now use a Boolean preference to achieve the same effect, but since
it's not tied to first-run it will allow us to continue to look for
the promoCode file even in the above scenario. Once we've checked for
the promoCode file we flip the flag so that there's no long-term
cost.

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Verified that these changes build without errors on
    • Windows
    • macOS
    • Linux
  • Verified that these changes pass automated tests (npm test brave_unit_tests && npm test brave_browser_tests) on
    • Windows
    • macOS
    • Linux
  • Ran git rebase master (if needed).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.
  • Add appropriate QA labels (QA/Yes or QA/No) to include the closed issue in milestone

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

We previously only looked for the promoCode file on first
run. However, since there's a short delay before we launch the task to
read the promoCode file, there's a window of opportunity for a user to
close the browser before we read the file. This puts the user in a
state where the first run has occurred but the promoCode file wasn't
read (and therefore won't ever be read).

We now use a Boolean preference to achieve the same effect, but since
it's not tied to first-run it will allow us to continue to look for
the promoCode file even in the above scenario. Once we've checked for
the promoCode file we flip the flag so that there's no long-term
cost.
@emerick emerick self-assigned this Oct 24, 2018
@emerick emerick requested a review from bbondy October 24, 2018 13:43
@emerick emerick merged commit 080080b into master Oct 24, 2018
@emerick emerick deleted the promo-code-never-claimed branch October 24, 2018 23:53
emerick added a commit that referenced this pull request Oct 24, 2018
Promo code is never claimed if user closes browser too soon
emerick added a commit that referenced this pull request Oct 24, 2018
Promo code is never claimed if user closes browser too soon
emerick added a commit that referenced this pull request Oct 24, 2018
Promo code is never claimed if user closes browser too soon
@emerick
Copy link
Contributor Author

emerick commented Oct 24, 2018

master: 080080b
0.55.x: c61aff9
0.56.x: 16fd58c
0.57.x: 31ba2c4

@bbondy
Copy link
Member

bbondy commented Oct 30, 2018

won't be in 0.55.x hotfix2 so I updated label to 0.56.x.

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.

promoCode is never claimed after closing browser just after install
2 participants