diff options
notices - markAllNoticesRead - use async/await
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/metamask-controller.js | 2 | ||||
-rw-r--r-- | app/scripts/notice-controller.js | 23 |
2 files changed, 10 insertions, 15 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index ce59caf83..058d527c0 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -473,7 +473,7 @@ module.exports = class MetamaskController extends EventEmitter { // notices checkNotices: noticeController.updateNoticesList.bind(noticeController), markNoticeRead: noticeController.markNoticeRead.bind(noticeController), - markAllNoticesRead: noticeController.markAllNoticesRead.bind(noticeController), + markAllNoticesRead: nodeify(noticeController.markAllNoticesRead, noticeController), approveProviderRequest: providerApprovalController.approveProviderRequest.bind(providerApprovalController), clearApprovedOrigins: providerApprovalController.clearApprovedOrigins.bind(providerApprovalController), diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js index d1a15ff08..050fca9c8 100644 --- a/app/scripts/notice-controller.js +++ b/app/scripts/notice-controller.js @@ -58,20 +58,15 @@ module.exports = class NoticeController extends EventEmitter { } } - markAllNoticesRead (cb) { - cb = cb || function (err) { if (err) throw err } - try { - const noticeList = this.getNoticesList() - noticeList.forEach(notice => { - notice.read = true - notice.body = '' - }) - this.setNoticesList(noticeList) - const latestNotice = this.getNextUnreadNotice() - cb(null, latestNotice) - } catch (err) { - cb(err) - } + async markAllNoticesRead () { + const noticeList = this.getNoticesList() + noticeList.forEach(notice => { + notice.read = true + notice.body = '' + }) + this.setNoticesList(noticeList) + const latestNotice = this.getNextUnreadNotice() + return latestNotice } |