follow request bugfixes, wrong text, notifs not being marked as read, approving from follow request view
This commit is contained in:
parent
ab3c0e8512
commit
36dcfa8cc1
|
@ -1,4 +1,5 @@
|
||||||
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
||||||
|
import { notificationsFromStore } from '../../services/notification_utils/notification_utils.js'
|
||||||
|
|
||||||
const FollowRequestCard = {
|
const FollowRequestCard = {
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
|
@ -6,13 +7,31 @@ const FollowRequestCard = {
|
||||||
BasicUserCard
|
BasicUserCard
|
||||||
},
|
},
|
||||||
methods: {
|
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 () {
|
approveUser () {
|
||||||
this.$store.state.api.backendInteractor.approveUser({ id: this.user.id })
|
this.$store.state.api.backendInteractor.approveUser({ id: this.user.id })
|
||||||
this.$store.dispatch('removeFollowRequest', this.user)
|
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 () {
|
denyUser () {
|
||||||
this.$store.state.api.backendInteractor.denyUser({ id: this.user.id })
|
this.$store.state.api.backendInteractor.denyUser({ id: this.user.id })
|
||||||
this.$store.dispatch('removeFollowRequest', this.user)
|
this.$store.dispatch('removeFollowRequest', this.user)
|
||||||
|
|
||||||
|
const notifId = this.findFollowRequestNotificationId()
|
||||||
|
this.$store.dispatch('dismissNotification', { id: notifId })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ const Notification = {
|
||||||
id: this.notification.id,
|
id: this.notification.id,
|
||||||
updater: notification => {
|
updater: notification => {
|
||||||
notification.type = 'follow'
|
notification.type = 'follow'
|
||||||
|
notification.seen = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -137,13 +137,13 @@
|
||||||
style="white-space: nowrap;"
|
style="white-space: nowrap;"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="icon-ok button-icon add-reaction-button"
|
class="icon-ok button-icon follow-request-accept"
|
||||||
:title="$t('tool_tip.accept_follow_request')"
|
:title="$t('tool_tip.accept_follow_request')"
|
||||||
@click="approveUser()"
|
@click="approveUser()"
|
||||||
/>
|
/>
|
||||||
<i
|
<i
|
||||||
class="icon-cancel button-icon add-reaction-button"
|
class="icon-cancel button-icon follow-request-reject"
|
||||||
:title="$t('tool_tip.accept_follow_request')"
|
:title="$t('tool_tip.reject_follow_request')"
|
||||||
@click="denyUser()"
|
@click="denyUser()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -79,6 +79,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.follow-request-accept {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: $fallback--text;
|
||||||
|
color: var(--text, $fallback--text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.follow-request-reject {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: $fallback--cRed;
|
||||||
|
color: var(--cRed, $fallback--cRed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.follow-text, .move-text {
|
.follow-text, .move-text {
|
||||||
padding: 0.5em 0;
|
padding: 0.5em 0;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
|
|
Loading…
Reference in New Issue