Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Adds transition for disabled wallets #11626

Merged
merged 3 commits into from
Oct 23, 2017

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Oct 23, 2017

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).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Resolves #11611
Resolves #11614

Auditors:

Plan A

  • launch 0.18.36 and enable payments via about:preferences#payments
  • visit several websites and ensure they're appearing under the ledger table
  • disable payments via the "On/Off" switch under about:preferences#payments
  • switch to this branch
  • go back into about:preferences#payments and enable payments
  • ledger table should be the same as it was on 0.18.36

Plan B

  • launch 0.18.36 and enable payments via about:preferences#payments
  • disable payments via the "On/Off" switch under about:preferences#payments
  • switch to this branch
  • go back into about:preferences#payments and enable payments
  • transition overlay should be triggered

Plan C

  • go to preferences and try to toggle payments on/off multiple times
  • there shouldn't be any errors in the log
  • wallet should be created when you leave it on

Plan D

  • launch 0.18.36 and enable payments via about:preferences#payments
  • visit several websites and ensure they're appearing under the ledger table
  • disable payments via the "On/Off" switch under about:preferences#payments
  • switch to this branch
  • go to preferences and try to toggle payments on/off multiple times
  • wallet should be converted when you leave it on

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@NejcZdovc
Copy link
Contributor Author

when this is merged and new build is done, we need to check if we didn't regressed in #11506

@@ -2212,7 +2226,7 @@ const migration = (state) => {
}
})
} catch (err) {
console.log('Error migrating file', err.toString())
console.log(err.toString())
Copy link
Member

Choose a reason for hiding this comment

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

nit console.error here so it has callstack too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will check the whole ledger.js file and replace it where needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -2327,7 +2364,7 @@ const transitionWalletToBat = () => {

try {
client.transition(newPaymentId, (err, properties) => {
if (err) {
if (err || newClient == null) {
Copy link
Member

Choose a reason for hiding this comment

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

I think you want !newClient here because otherwise newClient's false could be used in the else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


hasBeenNotified: (state) => {
state = validateState(state)
return state.getIn(['migrations', 'batMercuryTimestamp']) !== state.getIn(['migrations', 'btc2BatNotifiedTimestamp'])
Copy link
Member

Choose a reason for hiding this comment

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

Pls add comment here that this only happens on initial state, I think that's the case from reading the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


hasUpgradedWallet: (state) => {
state = validateState(state)
return state.getIn(['migrations', 'batMercuryTimestamp']) !== state.getIn(['migrations', 'btc2BatTimestamp'])
Copy link
Member

Choose a reason for hiding this comment

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

Pls add comment here that this only happens on initial state, I think that's the case from reading the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@NejcZdovc NejcZdovc force-pushed the hotfix/#11611-disabled branch from 37b6568 to 87bd992 Compare October 23, 2017 13:56
@NejcZdovc NejcZdovc force-pushed the hotfix/#11611-disabled branch from 87bd992 to 9c8f3b5 Compare October 23, 2017 19:12
@codecov-io
Copy link

codecov-io commented Oct 23, 2017

Codecov Report

Merging #11626 into master will increase coverage by 0.07%.
The diff coverage is 76.47%.

@@            Coverage Diff             @@
##           master   #11626      +/-   ##
==========================================
+ Coverage   52.26%   52.33%   +0.07%     
==========================================
  Files         268      269       +1     
  Lines       25311    25377      +66     
  Branches     4034     4042       +8     
==========================================
+ Hits        13228    13281      +53     
- Misses      12083    12096      +13
Flag Coverage Δ
#unittest 52.33% <76.47%> (+0.07%) ⬆️
Impacted Files Coverage Δ
app/browser/api/ledger.js 31.3% <59.18%> (+0.29%) ⬆️
app/browser/reducers/ledgerReducer.js 43.37% <88.88%> (-0.4%) ⬇️
app/common/state/migrationState.js 93.33% <93.18%> (ø)

@NejcZdovc NejcZdovc merged commit 696ef66 into brave:master Oct 23, 2017
NejcZdovc added a commit that referenced this pull request Oct 23, 2017
NejcZdovc added a commit that referenced this pull request Oct 23, 2017
NejcZdovc added a commit that referenced this pull request Oct 23, 2017
@NejcZdovc
Copy link
Contributor Author

master 696ef66
0.21 bcedf7b
0.20 a1a88e1
0.19 d86f227

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants