Don't add notifications twice + persiste them.
This commit is contained in:
parent
963a0035e5
commit
209e8614b0
@ -29,7 +29,7 @@ Vue.use(VueTimeago, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const persistedStateOptions = {
|
const persistedStateOptions = {
|
||||||
paths: ['users.users']
|
paths: ['users.users', 'statuses.notifications']
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
|
@ -173,8 +173,11 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
|
|||||||
}
|
}
|
||||||
|
|
||||||
const addNotification = ({type, status, action}) => {
|
const addNotification = ({type, status, action}) => {
|
||||||
|
// 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})
|
state.notifications.push({type, status, action, seen: false})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const favoriteStatus = (favorite) => {
|
const favoriteStatus = (favorite) => {
|
||||||
const status = find(allStatuses, { id: toInteger(favorite.in_reply_to_status_id) })
|
const status = find(allStatuses, { id: toInteger(favorite.in_reply_to_status_id) })
|
||||||
|
Loading…
Reference in New Issue
Block a user