#436: remove clear & dismiss UI updates

This commit is contained in:
dave 2019-03-14 11:57:24 -04:00
parent 06fda27511
commit 52326e6551
9 changed files with 4 additions and 82 deletions

View file

@ -1,4 +1,4 @@
import { remove, slice, each, find, findIndex, maxBy, minBy, merge, first, last, isArray } from 'lodash'
import { remove, slice, each, find, maxBy, minBy, merge, first, last, isArray } from 'lodash'
import apiService from '../services/api/api.service.js'
// import parse from '../services/status_parser/status_parser.js'
@ -390,27 +390,6 @@ export const mutations = {
notification.seen = true
})
},
clearNotifications (state) {
state.notifications.data = []
state.notifications.idStore = {}
state.notifications.maxId = 0
state.notifications.minId = 0
},
dismissNotifications (state, { id }) {
const { data } = state.notifications
const idx = findIndex(data, { id })
if (idx !== -1) {
const notification = data[idx]
data.splice(idx, 1)
delete state.notifications.idStore[id]
if (state.notifications.maxId === notification.id) {
state.notifications.maxId = data.length ? maxBy(data, 'id').id : 0
} else if (state.notifications.minId === notification.id) {
state.notifications.minId = data.length ? minBy(data, 'id').id : 0
}
}
},
queueFlush (state, { timeline, id }) {
state.timelines[timeline].flushMarker = id
}
@ -495,19 +474,6 @@ const statuses = {
id: rootState.statuses.notifications.maxId,
credentials: rootState.users.currentUser.credentials
})
},
clearNotifications ({ rootState, commit }) {
commit('clearNotifications')
apiService.clearNotifications({
credentials: rootState.users.currentUser.credentials
})
},
dismissNotifications ({ rootState, commit }, { id }) {
commit('dismissNotifications', { id })
apiService.dismissNotifications({
id,
credentials: rootState.users.currentUser.credentials
})
}
},
mutations