aboutsummaryrefslogtreecommitdiff
path: root/src/components/follow_request_card
diff options
context:
space:
mode:
authorShpuld Shpuldson <shp@cock.li>2020-05-02 10:19:47 +0300
committerShpuld Shpuldson <shp@cock.li>2020-05-02 10:19:47 +0300
commit406fdd8edec210d14589e0ff684a166250236779 (patch)
tree7b4cbe9c2c0d7e0a85080797aa86e91f0a9a197f /src/components/follow_request_card
parentc67e9daf068c5a7eafaa7ce6a6418c8916a4f118 (diff)
follow request bugfixes, wrong text, notifs not being marked as read, approving from follow request view
Diffstat (limited to 'src/components/follow_request_card')
-rw-r--r--src/components/follow_request_card/follow_request_card.js19
1 files changed, 19 insertions, 0 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..2a9d3db5 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,31 @@ 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('updateNotification', {
+ id: notifId,
+ updater: notification => {
+ notification.type = 'follow'
+ notification.seen = true
+ }
+ })
},
denyUser () {
this.$store.state.api.backendInteractor.denyUser({ id: this.user.id })
this.$store.dispatch('removeFollowRequest', this.user)
+
+ const notifId = this.findFollowRequestNotificationId()
+ this.$store.dispatch('dismissNotification', { id: notifId })
}
}
}