diff options
Diffstat (limited to 'src/modules/users.js')
| -rw-r--r-- | src/modules/users.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/users.js b/src/modules/users.js index cff16c47..2f05ed3f 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -66,6 +66,9 @@ export const mutations = { setUserForStatus (state, status) { status.user = state.usersObject[status.user.id] }, + setUserForNotification (state, notification) { + notification.action.user = state.usersObject[notification.action.user.id] + }, setColor (state, { user: { id }, highlighted }) { const user = state.usersObject[id] set(user, 'highlight', highlighted) @@ -137,6 +140,21 @@ const users = { store.commit('setUserForStatus', status) }) }, + addNewNotifications (store, { notifications }) { + const users = compact(map(notifications, 'from_profile')) + const notificationIds = compact(notifications.map(_ => String(_.id))) + store.commit('addNewUsers', users) + + const notificationsObject = store.rootState.statuses.notifications.idStore + const relevantNotifications = Object.entries(notificationsObject) + .filter(([k, val]) => notificationIds.includes(k)) + .map(([k, val]) => val) + + // Reconnect users to notifications + each(relevantNotifications, (notification) => { + store.commit('setUserForNotification', notification) + }) + }, async signUp (store, userInfo) { store.commit('signUpPending') |
