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

Delete Dai/Sai migration notification #8418

Merged
merged 1 commit into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
"dismiss": {
"message": "Dismiss"
},
"migrateSai": {
"message": "A message from Maker: The new Multi-Collateral Dai token has been released. Your old tokens are now called Sai. Please upgrade your Sai tokens to the new Dai."
},
"migrateSaiInfo": {
"message": "To dismiss this notification you can migrate your tokens or hide SAI from the token list."
},
"migrate": {
"message": "Migrate"
},
"showIncomingTransactions": {
"message": "Show Incoming Transactions"
},
Expand Down
9 changes: 0 additions & 9 deletions app/_locales/it/messages.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
{
"migrateSai": {
"message": "Un messaggio da Maker: il nuovo Dai Multi-Collaterale è stato rilasciato. Ora i token precedenti si chiamano Sai. Aggiorna i tuoi Sai ai nuovi Dai."
},
"migrateSaiInfo": {
"message": "Per eliminare questa notifica puoi migrare i tuoi token o nascondere SAI dalla lista dei token."
},
"migrate": {
"message": "Migra"
},
"showIncomingTransactions": {
"message": "Mostra Transazioni in Ingresso"
},
Expand Down
7 changes: 0 additions & 7 deletions app/scripts/controllers/app-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class AppStateController extends EventEmitter {
this.onInactiveTimeout = onInactiveTimeout || (() => {})
this.store = new ObservableStore(Object.assign({
timeoutMinutes: 0,
mkrMigrationReminderTimestamp: null,
connectedStatusPopoverHasBeenShown: true,
}, initState))
this.timer = null
Expand Down Expand Up @@ -67,12 +66,6 @@ class AppStateController extends EventEmitter {
}
}

setMkrMigrationReminderTimestamp (timestamp) {
this.store.updateState({
mkrMigrationReminderTimestamp: timestamp,
})
}

/**
* Record that the user has seen the connected status info popover
*/
Expand Down
1 change: 0 additions & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ export default class MetamaskController extends EventEmitter {

// AppStateController
setLastActiveTime: nodeify(this.appStateController.setLastActiveTime, this.appStateController),
setMkrMigrationReminderTimestamp: nodeify(this.appStateController.setMkrMigrationReminderTimestamp, this.appStateController),
setConnectedStatusPopoverHasBeenShown: nodeify(this.appStateController.setConnectedStatusPopoverHasBeenShown, this.appStateController),

// EnsController
Expand Down
23 changes: 23 additions & 0 deletions app/scripts/migrations/044.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const version = 44
import { cloneDeep } from 'lodash'

/**
* Remove unused 'mkrMigrationReminderTimestamp' state from the `AppStateController`
*/
export default {
version,
migrate: async function (originalVersionedData) {
const versionedData = cloneDeep(originalVersionedData)
versionedData.meta.version = version
const state = versionedData.data
versionedData.data = transformState(state)
return versionedData
},
}

function transformState (state) {
if (typeof state?.AppStateController?.mkrMigrationReminderTimestamp !== 'undefined') {
delete state.AppStateController.mkrMigrationReminderTimestamp
}
return state
}
1 change: 1 addition & 0 deletions app/scripts/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const migrations = [
require('./041').default,
require('./042').default,
require('./043').default,
require('./044').default,
]

export default migrations
75 changes: 75 additions & 0 deletions test/unit/migrations/044-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { strict as assert } from 'assert'
import migration44 from '../../../app/scripts/migrations/044'

describe('migration #44', function () {
it('should update the version metadata', async function () {
const oldStorage = {
'meta': {
'version': 43,
},
'data': {},
}

const newStorage = await migration44.migrate(oldStorage)
assert.deepEqual(newStorage.meta, {
'version': 44,
})
})

it('should delete mkrMigrationReminderTimestamp state', async function () {
const oldStorage = {
meta: {},
data: {
AppStateController: {
mkrMigrationReminderTimestamp: 'some timestamp',
bar: 'baz',
},
foo: 'bar',
},
}

const newStorage = await migration44.migrate(oldStorage)
assert.deepEqual(newStorage.data, {
AppStateController: {
bar: 'baz',
},
foo: 'bar',
})
})

it('should delete mkrMigrationReminderTimestamp state if it is null', async function () {
const oldStorage = {
meta: {},
data: {
AppStateController: {
mkrMigrationReminderTimestamp: null,
bar: 'baz',
},
foo: 'bar',
},
}

const newStorage = await migration44.migrate(oldStorage)
assert.deepEqual(newStorage.data, {
AppStateController: {
bar: 'baz',
},
foo: 'bar',
})
})

it('should do nothing if mkrMigrationReminderTimestamp state does not exist', async function () {
const oldStorage = {
meta: {},
data: {
AppStateController: {
bar: 'baz',
},
foo: 'bar',
},
}

const newStorage = await migration44.migrate(oldStorage)
assert.deepEqual(oldStorage.data, newStorage.data)
})
})

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion ui/app/components/app/dai-migration-component/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions ui/app/pages/home/home.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Redirect, Route } from 'react-router-dom'
import { formatDate } from '../../helpers/utils/util'
import AssetList from '../../components/app/asset-list'
import HomeNotification from '../../components/app/home-notification'
import DaiMigrationNotification from '../../components/app/dai-migration-component'
import MultipleNotifications from '../../components/app/multiple-notifications'
import WalletView from '../../components/app/wallet-view'
import TransactionList from '../../components/app/transaction-list'
Expand All @@ -30,10 +29,6 @@ export default class Home extends PureComponent {
t: PropTypes.func,
}

static defaultProps = {
hasDaiV1Token: false,
}

static propTypes = {
history: PropTypes.object,
forgottenPassword: PropTypes.bool,
Expand All @@ -50,7 +45,6 @@ export default class Home extends PureComponent {
restoreFromThreeBox: PropTypes.func,
setShowRestorePromptToFalse: PropTypes.func,
threeBoxLastUpdated: PropTypes.number,
hasDaiV1Token: PropTypes.bool,
firstPermissionsRequestId: PropTypes.string,
totalUnapprovedCount: PropTypes.number.isRequired,
setConnectedStatusPopoverHasBeenShown: PropTypes.func,
Expand Down Expand Up @@ -114,7 +108,6 @@ export default class Home extends PureComponent {
const { t } = this.context
const {
history,
hasDaiV1Token,
shouldShowSeedPhraseReminder,
isPopup,
selectedAddress,
Expand Down Expand Up @@ -168,11 +161,6 @@ export default class Home extends PureComponent {
)
: null
}
{
hasDaiV1Token
? <DaiMigrationNotification />
: null
}
</MultipleNotifications>
)
}
Expand Down
2 changes: 0 additions & 2 deletions ui/app/pages/home/home.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from '../../selectors/confirm-transaction'
import {
getCurrentEthBalance,
getDaiV1Token,
getFirstPermissionRequest,
getTotalUnapprovedCount,
} from '../../selectors/selectors'
Expand Down Expand Up @@ -60,7 +59,6 @@ const mapStateToProps = (state) => {
showRestorePrompt,
selectedAddress,
threeBoxLastUpdated,
hasDaiV1Token: Boolean(getDaiV1Token(state)),
firstPermissionsRequestId,
totalUnapprovedCount,
connectedStatusPopoverHasBeenShown,
Expand Down
6 changes: 0 additions & 6 deletions ui/app/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,6 @@ export function getAddressBookEntryName (state, address) {
return entry && entry.name !== '' ? entry.name : shortenAddress(address)
}

export function getDaiV1Token (state) {
const OLD_DAI_CONTRACT_ADDRESS = '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359'
const tokens = state.metamask.tokens || []
return tokens.find(({ address }) => checksumAddress(address) === OLD_DAI_CONTRACT_ADDRESS)
}

export function accountsWithSendEtherInfoSelector (state) {
const accounts = getMetaMaskAccounts(state)
const { identities } = state.metamask
Expand Down
10 changes: 0 additions & 10 deletions ui/app/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2134,16 +2134,6 @@ export function setLastActiveTime () {
}
}

export function setMkrMigrationReminderTimestamp (timestamp) {
return (dispatch) => {
background.setMkrMigrationReminderTimestamp(timestamp, (err) => {
if (err) {
return dispatch(displayWarning(err.message))
}
})
}
}

export function setConnectedStatusPopoverHasBeenShown () {
return () => {
background.setConnectedStatusPopoverHasBeenShown((err) => {
Expand Down