From 145b4e1e521f315f744183304bc2464794f74cbb Mon Sep 17 00:00:00 2001 From: lain Date: Thu, 25 Jun 2020 16:06:17 +0200 Subject: [PATCH] Notifications: Use notifications natively. --- .../follow_request_card.js | 2 +- src/components/notification/notification.js | 20 +++---- src/components/notification/notification.vue | 54 +++++++++---------- .../notifications/notifications.vue | 4 +- src/modules/statuses.js | 34 ++++++------ src/modules/users.js | 5 +- .../entity_normalizer.service.js | 42 ++------------- .../notification_utils/notification_utils.js | 24 ++++----- 8 files changed, 76 insertions(+), 109 deletions(-) diff --git a/src/components/follow_request_card/follow_request_card.js b/src/components/follow_request_card/follow_request_card.js index 365e765a..cbd75311 100644 --- a/src/components/follow_request_card/follow_request_card.js +++ b/src/components/follow_request_card/follow_request_card.js @@ -22,7 +22,7 @@ const FollowRequestCard = { this.$store.dispatch('updateNotification', { id: notifId, updater: notification => { - notification.redux.type = 'follow' + notification.type = 'follow' } }) }, diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 6bbf9a6e..f89a35d4 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -31,7 +31,7 @@ const Notification = { return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames) }, getUser (notification) { - return this.$store.state.users.usersObject[notification.redux.account.id] + return this.$store.state.users.usersObject[notification.account.id] }, toggleMute () { this.unmuted = !this.unmuted @@ -39,39 +39,39 @@ const Notification = { approveUser () { this.$store.state.api.backendInteractor.approveUser({ id: this.user.id }) this.$store.dispatch('removeFollowRequest', this.user) - this.$store.dispatch('markSingleNotificationAsSeen', { id: this.notification.redux.id }) + this.$store.dispatch('markSingleNotificationAsSeen', { id: this.notification.id }) this.$store.dispatch('updateNotification', { - id: this.notification.redux.id, + id: this.notification.id, updater: notification => { - notification.redux.type = 'follow' + notification.type = 'follow' } }) }, denyUser () { this.$store.state.api.backendInteractor.denyUser({ id: this.user.id }) .then(() => { - this.$store.dispatch('dismissNotificationLocal', { id: this.notification.redux.id }) + this.$store.dispatch('dismissNotificationLocal', { id: this.notification.id }) this.$store.dispatch('removeFollowRequest', this.user) }) } }, computed: { userClass () { - return highlightClass(this.notification.redux.account) + return highlightClass(this.notification.account) }, userStyle () { const highlight = this.$store.getters.mergedConfig.highlight - const user = this.notification.redux.account + const user = this.notification.account return highlightStyle(highlight[user.screen_name]) }, user () { - return this.$store.getters.findUser(this.notification.redux.account.id) + return this.$store.getters.findUser(this.notification.account.id) }, userProfileLink () { return this.generateUserProfileLink(this.user) }, targetUser () { - return this.$store.getters.findUser(this.notification.redux.target.id) + return this.$store.getters.findUser(this.notification.target.id) }, targetUserProfileLink () { return this.generateUserProfileLink(this.targetUser) @@ -80,7 +80,7 @@ const Notification = { return this.$store.getters.relationship(this.user.id).muting }, isStatusNotification () { - return (this.notification.redux.type) + return (this.notification.type) } } } diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 93cda80c..2b1f548d 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -1,8 +1,8 @@