diff --git a/app/browser/api/ledger.js b/app/browser/api/ledger.js index 4854d693c52..68fb4190a4f 100644 --- a/app/browser/api/ledger.js +++ b/app/browser/api/ledger.js @@ -160,7 +160,7 @@ const notifications = { // One time conversion of wallet const isNewInstall = state.get('firstRunTimestamp') === state.getIn(['migrations', 'batMercuryTimestamp']) - const hasUpgradedWallet = state.getIn(['migrations', 'batMercuryTimestamp']) !== state.getIn(['migrations', 'btcToBatTimestamp']) + const hasUpgradedWallet = state.getIn(['migrations', 'batMercuryTimestamp']) !== state.getIn(['migrations', 'btc2BatTimestamp']) if (!isNewInstall && !hasUpgradedWallet) { module.exports.transitionWalletToBat(state) } @@ -178,7 +178,7 @@ const notifications = { // - wallet has been transitioned // - notification has not already been shown yet // (see https://github.com/brave/browser-laptop/issues/11021) - const hasBeenNotified = state.getIn(['migrations', 'batMercuryTimestamp']) !== state.getIn(['migrations', 'btcToBatNotifiedTimestamp']) + const hasBeenNotified = state.getIn(['migrations', 'batMercuryTimestamp']) !== state.getIn(['migrations', 'btc2BatNotifiedTimestamp']) if (!isNewInstall && hasUpgradedWallet && !hasBeenNotified) { notifications.showBraveWalletUpdated() } diff --git a/app/browser/reducers/ledgerReducer.js b/app/browser/reducers/ledgerReducer.js index 019156b0eae..6c3afe3bf6f 100644 --- a/app/browser/reducers/ledgerReducer.js +++ b/app/browser/reducers/ledgerReducer.js @@ -314,12 +314,12 @@ const ledgerReducer = (state, action, immutableAction) => { } case appConstants.APP_ON_BTC_TO_BAT_NOTIFIED: { - state = state.setIn(['migrations', 'btcToBatNotifiedTimestamp'], new Date().getTime()) + state = state.setIn(['migrations', 'btc2BatNotifiedTimestamp'], new Date().getTime()) break } case appConstants.APP_ON_BTC_TO_BAT_TRANSITIONED: { - state = state.setIn(['migrations', 'btcToBatTimestamp'], new Date().getTime()) + state = state.setIn(['migrations', 'btc2BatTimestamp'], new Date().getTime()) break } case appConstants.APP_ON_LEDGER_QR_GENERATED: diff --git a/app/sessionStore.js b/app/sessionStore.js index 941005b6ee3..8296f0b9ac4 100644 --- a/app/sessionStore.js +++ b/app/sessionStore.js @@ -832,8 +832,8 @@ module.exports.defaultAppState = () => { }, migrations: { batMercuryTimestamp: now, - btcToBatTimestamp: now, - btcToBatNotifiedTimestamp: now + btc2BatTimestamp: now, + btc2BatNotifiedTimestamp: now } } } diff --git a/docs/state.md b/docs/state.md index d5d598d5a34..54be54129f1 100644 --- a/docs/state.md +++ b/docs/state.md @@ -227,8 +227,8 @@ AppStore }, migrations: { batMercuryTimestamp: integer, // when session is upgraded (and this new schema added) - btcToBatTimestamp: integer, // when call was made to backend to convert BTC => BAT - btcToBatNotifiedTimestamp: integer, // when user was shown "wallet upgraded" notification + btc2BatTimestamp: integer, // when call was made to backend to convert BTC => BAT + btc2BatNotifiedTimestamp: integer, // when user was shown "wallet upgraded" notification }, menu: { template: object // used on Windows and by our tests: template object with Menubar control diff --git a/test/unit/app/browser/api/ledgerTest.js b/test/unit/app/browser/api/ledgerTest.js index 0e26d376c32..d55976a8985 100644 --- a/test/unit/app/browser/api/ledgerTest.js +++ b/test/unit/app/browser/api/ledgerTest.js @@ -221,8 +221,8 @@ describe('ledger api unit tests', function () { firstRunTimestamp: 12345, migrations: { batMercuryTimestamp: 12345, - btcToBatTimestamp: 12345, - btcToBatNotifiedTimestamp: 12345 + btc2BatTimestamp: 12345, + btc2BatNotifiedTimestamp: 12345 } })) }) @@ -236,8 +236,8 @@ describe('ledger api unit tests', function () { it('does not notify the user', function () { const targetSession = ledgerStateWithBalance .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 54321) - .setIn(['migrations', 'btcToBatNotifiedTimestamp'], 32145) + .setIn(['migrations', 'btc2BatTimestamp'], 54321) + .setIn(['migrations', 'btc2BatNotifiedTimestamp'], 32145) ledgerApi.notifications.onLaunch(targetSession) assert(showBraveWalletUpdatedSpy.notCalled) }) @@ -251,8 +251,8 @@ describe('ledger api unit tests', function () { it('does not notify the user', function () { const targetSession = ledgerStateWithBalance .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 54321) - .setIn(['migrations', 'btcToBatNotifiedTimestamp'], 32145) + .setIn(['migrations', 'btc2BatTimestamp'], 54321) + .setIn(['migrations', 'btc2BatNotifiedTimestamp'], 32145) ledgerApi.notifications.onLaunch(targetSession) assert(showBraveWalletUpdatedSpy.notCalled) }) @@ -267,8 +267,8 @@ describe('ledger api unit tests', function () { const targetSession = ledgerStateWithBalance .setIn(['ledger', 'info', 'balance'], 0) .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 54321) - .setIn(['migrations', 'btcToBatNotifiedTimestamp'], 32145) + .setIn(['migrations', 'btc2BatTimestamp'], 54321) + .setIn(['migrations', 'btc2BatNotifiedTimestamp'], 32145) ledgerApi.notifications.onLaunch(targetSession) assert(showBraveWalletUpdatedSpy.notCalled) }) @@ -293,8 +293,8 @@ describe('ledger api unit tests', function () { it('does not notify the user', function () { const targetSession = ledgerStateWithBalance .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 32145) - .setIn(['migrations', 'btcToBatNotifiedTimestamp'], 32145) + .setIn(['migrations', 'btc2BatTimestamp'], 32145) + .setIn(['migrations', 'btc2BatNotifiedTimestamp'], 32145) ledgerApi.notifications.onLaunch(targetSession) assert(showBraveWalletUpdatedSpy.notCalled) }) @@ -308,8 +308,8 @@ describe('ledger api unit tests', function () { it('does not notify the user', function () { const targetSession = ledgerStateWithBalance .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 54321) - .setIn(['migrations', 'btcToBatNotifiedTimestamp'], 54321) + .setIn(['migrations', 'btc2BatTimestamp'], 54321) + .setIn(['migrations', 'btc2BatNotifiedTimestamp'], 54321) ledgerApi.notifications.onLaunch(targetSession) assert(showBraveWalletUpdatedSpy.notCalled) }) @@ -323,8 +323,8 @@ describe('ledger api unit tests', function () { it('notifies the user', function () { const targetSession = ledgerStateWithBalance .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 54321) - .setIn(['migrations', 'btcToBatNotifiedTimestamp'], 32145) + .setIn(['migrations', 'btc2BatTimestamp'], 54321) + .setIn(['migrations', 'btc2BatNotifiedTimestamp'], 32145) ledgerApi.notifications.onLaunch(targetSession) assert(showBraveWalletUpdatedSpy.calledOnce) }) @@ -340,7 +340,7 @@ describe('ledger api unit tests', function () { it('calls ledger.transitionWalletToBat', function () { const targetSession = ledgerStateWithBalance .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 32145) + .setIn(['migrations', 'btc2BatTimestamp'], 32145) ledgerApi.notifications.onLaunch(targetSession) assert(transitionWalletToBatSpy.calledOnce) }) @@ -366,7 +366,7 @@ describe('ledger api unit tests', function () { const ledgerStateWithoutBalance = ledgerStateWithBalance .setIn(['ledger', 'info', 'balance'], 0) .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 32145) + .setIn(['migrations', 'btc2BatTimestamp'], 32145) ledgerApi.notifications.onLaunch(ledgerStateWithoutBalance) assert(transitionWalletToBatSpy.calledOnce) }) @@ -391,7 +391,7 @@ describe('ledger api unit tests', function () { it('does not call ledger.transitionWalletToBat', function () { const ledgerStateSeenNotification = ledgerStateWithBalance .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 54321) + .setIn(['migrations', 'btc2BatTimestamp'], 54321) ledgerApi.notifications.onLaunch(ledgerStateSeenNotification) assert(transitionWalletToBatSpy.notCalled) }) @@ -405,7 +405,7 @@ describe('ledger api unit tests', function () { it('calls ledger.transitionWalletToBat', function () { const targetSession = ledgerStateWithBalance .setIn(['migrations', 'batMercuryTimestamp'], 32145) - .setIn(['migrations', 'btcToBatTimestamp'], 32145) + .setIn(['migrations', 'btc2BatTimestamp'], 32145) ledgerApi.notifications.onLaunch(targetSession) assert(transitionWalletToBatSpy.calledOnce) }) diff --git a/test/unit/app/browser/reducers/ledgerReducerTest.js b/test/unit/app/browser/reducers/ledgerReducerTest.js index 5fceedd9b63..1f72fc5c5cd 100644 --- a/test/unit/app/browser/reducers/ledgerReducerTest.js +++ b/test/unit/app/browser/reducers/ledgerReducerTest.js @@ -509,7 +509,7 @@ describe('ledgerReducer unit tests', function () { }) it('sets the notification timestamp', function () { assert.notDeepEqual(returnedState, appState) - assert(returnedState.getIn(['migrations', 'btcToBatNotifiedTimestamp'])) + assert(returnedState.getIn(['migrations', 'btc2BatNotifiedTimestamp'])) }) }) @@ -521,7 +521,7 @@ describe('ledgerReducer unit tests', function () { }) it('sets the timestamp', function () { assert.notDeepEqual(returnedState, appState) - assert(returnedState.getIn(['migrations', 'btcToBatTimestamp'])) + assert(returnedState.getIn(['migrations', 'btc2BatTimestamp'])) }) }) })