commit: 209e8614b09ab7f24262d86de0924bd2e0dd96ec
parent: 963a0035e5e3f35ee790aeb3db64cb8dd32a84a4
Author: Roger Braun <roger@rogerbraun.net>
Date: Sat, 18 Feb 2017 20:56:03 +0100
Don't add notifications twice + persiste them.
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/main.js b/src/main.js
@@ -29,7 +29,7 @@ Vue.use(VueTimeago, {
})
const persistedStateOptions = {
- paths: ['users.users']
+ paths: ['users.users', 'statuses.notifications']
}
const store = new Vuex.Store({
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
@@ -173,7 +173,10 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
}
const addNotification = ({type, status, action}) => {
- state.notifications.push({type, status, action, seen: false})
+ // Only add a new notification if we don't have one for the same action
+ if (!find(state.notifications, (oldNotification) => oldNotification.action.id === action.id)) {
+ state.notifications.push({type, status, action, seen: false})
+ }
}
const favoriteStatus = (favorite) => {