Add support for follow request notifications
This commit is contained in:
parent
dea7e2f6ac
commit
01b07f01e9
11 changed files with 131 additions and 23 deletions
|
@ -34,7 +34,8 @@ export const defaultState = {
|
|||
likes: true,
|
||||
repeats: true,
|
||||
moves: true,
|
||||
emojiReactions: false
|
||||
emojiReactions: false,
|
||||
followRequest: true
|
||||
},
|
||||
webPushNotifications: false,
|
||||
muteWords: [],
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
omitBy
|
||||
} from 'lodash'
|
||||
import { set } from 'vue'
|
||||
import { isStatusNotification } from '../services/notification_utils/notification_utils.js'
|
||||
import apiService from '../services/api/api.service.js'
|
||||
// import parse from '../services/status_parser/status_parser.js'
|
||||
|
||||
|
@ -321,7 +322,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
|
|||
|
||||
const addNewNotifications = (state, { dispatch, notifications, older, visibleNotificationTypes, rootGetters }) => {
|
||||
each(notifications, (notification) => {
|
||||
if (notification.type !== 'follow' && notification.type !== 'move') {
|
||||
if (isStatusNotification(notification.type)) {
|
||||
notification.action = addStatusToGlobalStorage(state, notification.action).item
|
||||
notification.status = notification.status && addStatusToGlobalStorage(state, notification.status).item
|
||||
}
|
||||
|
@ -361,13 +362,16 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
|||
case 'move':
|
||||
i18nString = 'migrated_to'
|
||||
break
|
||||
case 'follow_request':
|
||||
i18nString = 'follow_request'
|
||||
break
|
||||
}
|
||||
|
||||
if (notification.type === 'pleroma:emoji_reaction') {
|
||||
notifObj.body = rootGetters.i18n.t('notifications.reacted_with', [notification.emoji])
|
||||
} else if (i18nString) {
|
||||
notifObj.body = rootGetters.i18n.t('notifications.' + i18nString)
|
||||
} else {
|
||||
} else if (isStatusNotification(notification.type)) {
|
||||
notifObj.body = notification.status.text
|
||||
}
|
||||
|
||||
|
@ -521,6 +525,13 @@ export const mutations = {
|
|||
notification.seen = true
|
||||
})
|
||||
},
|
||||
dismissNotification (state, { id }) {
|
||||
state.notifications.data = state.notifications.data.filter(n => n.id !== id)
|
||||
},
|
||||
updateNotification (state, { id, updater }) {
|
||||
const notification = find(state.notifications.data, n => n.id === id)
|
||||
notification && updater(notification)
|
||||
},
|
||||
queueFlush (state, { timeline, id }) {
|
||||
state.timelines[timeline].flushMarker = id
|
||||
},
|
||||
|
@ -680,6 +691,13 @@ const statuses = {
|
|||
credentials: rootState.users.currentUser.credentials
|
||||
})
|
||||
},
|
||||
dismissNotification ({ rootState, commit }, { id }) {
|
||||
rootState.api.backendInteractor.dismissNotification({ id })
|
||||
.then(() => commit('dismissNotification', { id }))
|
||||
},
|
||||
updateNotification ({ rootState, commit }, { id, updater }) {
|
||||
commit('updateNotification', { id, updater })
|
||||
},
|
||||
fetchFavsAndRepeats ({ rootState, commit }, id) {
|
||||
Promise.all([
|
||||
rootState.api.backendInteractor.fetchFavoritedByUsers({ id }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue