diff options
| author | Shpuld Shpludson <shp@cock.li> | 2020-05-02 11:19:05 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2020-05-02 11:19:05 +0000 |
| commit | 5f90b6a384583a00769eeca3a6c6e2deec8bdd24 (patch) | |
| tree | fb6b7307cbb3785ae0b1da17fe7b1ac730e9965f /src/components/follow_request_card/follow_request_card.js | |
| parent | c67e9daf068c5a7eafaa7ce6a6418c8916a4f118 (diff) | |
| parent | 92ccaa97bb0a2c15b96e2fbcf03823ba902dc516 (diff) | |
Merge branch 'fix/follow-request-notification-bugfixes' into 'develop'
Fix remaining follow request notif problems
Closes #823
See merge request pleroma/pleroma-fe!1096
Diffstat (limited to 'src/components/follow_request_card/follow_request_card.js')
| -rw-r--r-- | src/components/follow_request_card/follow_request_card.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/components/follow_request_card/follow_request_card.js b/src/components/follow_request_card/follow_request_card.js index a8931787..cbd75311 100644 --- a/src/components/follow_request_card/follow_request_card.js +++ b/src/components/follow_request_card/follow_request_card.js @@ -1,4 +1,5 @@ import BasicUserCard from '../basic_user_card/basic_user_card.vue' +import { notificationsFromStore } from '../../services/notification_utils/notification_utils.js' const FollowRequestCard = { props: ['user'], @@ -6,13 +7,32 @@ const FollowRequestCard = { BasicUserCard }, methods: { + findFollowRequestNotificationId () { + const notif = notificationsFromStore(this.$store).find( + (notif) => notif.from_profile.id === this.user.id && notif.type === 'follow_request' + ) + return notif && notif.id + }, approveUser () { this.$store.state.api.backendInteractor.approveUser({ id: this.user.id }) this.$store.dispatch('removeFollowRequest', this.user) + + const notifId = this.findFollowRequestNotificationId() + this.$store.dispatch('markSingleNotificationAsSeen', { id: notifId }) + this.$store.dispatch('updateNotification', { + id: notifId, + updater: notification => { + notification.type = 'follow' + } + }) }, denyUser () { + const notifId = this.findFollowRequestNotificationId() this.$store.state.api.backendInteractor.denyUser({ id: this.user.id }) - this.$store.dispatch('removeFollowRequest', this.user) + .then(() => { + this.$store.dispatch('dismissNotificationLocal', { id: notifId }) + this.$store.dispatch('removeFollowRequest', this.user) + }) } } } |
