diff --git a/src/libs/migrateOnyx.js b/src/libs/migrateOnyx.js index 4a115536e654..289f8913b534 100644 --- a/src/libs/migrateOnyx.js +++ b/src/libs/migrateOnyx.js @@ -1,7 +1,6 @@ import _ from 'underscore'; import Log from './Log'; import RenamePriorityModeKey from './migrations/RenamePriorityModeKey'; -import RenameExpensifyNewsStatus from './migrations/RenameExpensifyNewsStatus'; import AddLastVisibleActionCreated from './migrations/AddLastVisibleActionCreated'; import PersonalDetailsByAccountID from './migrations/PersonalDetailsByAccountID'; import RenameReceiptFilename from './migrations/RenameReceiptFilename'; @@ -12,7 +11,7 @@ export default function () { return new Promise((resolve) => { // Add all migrations to an array so they are executed in order - const migrationPromises = [RenamePriorityModeKey, RenameExpensifyNewsStatus, AddLastVisibleActionCreated, PersonalDetailsByAccountID, RenameReceiptFilename]; + const migrationPromises = [RenamePriorityModeKey, AddLastVisibleActionCreated, PersonalDetailsByAccountID, RenameReceiptFilename]; // Reduce all promises down to a single promise. All promises run in a linear fashion, waiting for the // previous promise to finish before moving onto the next one. diff --git a/src/libs/migrations/RenameExpensifyNewsStatus.js b/src/libs/migrations/RenameExpensifyNewsStatus.js deleted file mode 100644 index 421879b0e8ad..000000000000 --- a/src/libs/migrations/RenameExpensifyNewsStatus.js +++ /dev/null @@ -1,34 +0,0 @@ -import Onyx from 'react-native-onyx'; -import _ from 'underscore'; -import ONYXKEYS from '../../ONYXKEYS'; -import Log from '../Log'; - -// This migration changes the name of the Onyx key user.expensifyNewsStatus from expensifyNewsStatus to isSubscribedToNewsletter -export default function () { - return new Promise((resolve) => { - // Connect to the USER key in Onyx to get the value of expensifyNewsStatus - // then set that value as isSubscribedToNewsletter - // finally remove expensifyNewsStatus by setting the value to null - const connectionID = Onyx.connect({ - key: ONYXKEYS.USER, - callback: (user) => { - Onyx.disconnect(connectionID); - - // Fail early here because there is nothing to migrate - if (!user || _.isNull(user.expensifyNewsStatus) || _.isUndefined(user.expensifyNewsStatus)) { - Log.info('[Migrate Onyx] Skipped migration RenameExpensifyNewsStatus'); - return resolve(); - } - - // eslint-disable-next-line rulesdir/prefer-actions-set-data - Onyx.merge(ONYXKEYS.USER, { - expensifyNewsStatus: null, - isSubscribedToNewsletter: user.expensifyNewsStatus, - }).then(() => { - Log.info('[Migrate Onyx] Ran migration RenameExpensifyNewsStatus'); - resolve(); - }); - }, - }); - }); -}