Don't add notifications twice + persiste them.

このコミットが含まれているのは:
Roger Braun 2017-02-18 20:56:03 +01:00
コミット 209e8614b0
2個のファイルの変更5行の追加2行の削除

ファイルの表示

@ -29,7 +29,7 @@ Vue.use(VueTimeago, {
})
const persistedStateOptions = {
paths: ['users.users']
paths: ['users.users', 'statuses.notifications']
}
const store = new Vuex.Store({

ファイルの表示

@ -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) => {