diff options
| author | Roger Braun <roger@rogerbraun.net> | 2017-02-18 20:56:03 +0100 |
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2017-02-18 20:56:03 +0100 |
| commit | 209e8614b09ab7f24262d86de0924bd2e0dd96ec (patch) | |
| tree | c054161a035d97ec3102f852f0deca4af9a5ea09 /src | |
| parent | 963a0035e5e3f35ee790aeb3db64cb8dd32a84a4 (diff) | |
Don't add notifications twice + persiste them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.js | 2 | ||||
| -rw-r--r-- | src/modules/statuses.js | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main.js b/src/main.js index 4b367db9..841e61a7 100644 --- 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 index 0967f77a..491d0024 100644 --- 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) => { |
