continue refactor

This commit is contained in:
Henry Jameson 2023-11-16 20:09:16 +02:00
parent aad3225d25
commit 6ed2cb8f43
2 changed files with 5 additions and 12 deletions

View File

@ -57,9 +57,7 @@ export const notifications = {
},
dismissNotification (state, { id }) {
state.data = state.data.filter(n => n.id !== id)
},
dismissNotifications (state, { finder }) {
state.data = state.data.filter(n => finder)
delete state.idStore[id]
},
updateNotification (state, { id, updater }) {
const notification = find(state.data, n => n.id === id)
@ -88,7 +86,6 @@ export const notifications = {
statusNotifications.forEach(notification => {
const id = notification.status.id
const referenceStatus = rootState.statuses.allStatusesObject[id]
console.log()
if (referenceStatus) {
notification.status = referenceStatus
@ -108,14 +105,13 @@ export const notifications = {
// eslint-disable-next-line no-prototype-builtins
if (!state.idStore.hasOwnProperty(notification.id)) {
commit('updateNotificationsMinMaxId', notification.id)
commit('addNewNotifications', { notifications: [notification] })
maybeShowNotification(store, notification)
} else if (notification.seen) {
state.idStore[notification.id].seen = true
}
})
commit('addNewNotifications', { notifications })
},
setNotificationsLoading ({ rootState, commit }, { value }) {
commit('setNotificationsLoading', { value })

View File

@ -139,11 +139,11 @@ const addStatusToGlobalStorage = (state, data) => {
return result
}
// XXX: this isn't actually really used anymore since deletes just don't appear outside streaming, thanks masto
// Remove status from the global storages (arrays and objects maintaining statuses) except timelines
const removeStatusFromGlobalStorage = (state, status) => {
remove(state.allStatuses, { id: status.id })
// TODO: Need to remove from allStatusesObject?
delete state.allStatusesObject[status.id]
// Remove from conversation
const conversationId = status.statusnet_conversation_id
@ -516,11 +516,8 @@ export const mutations = {
const statuses = {
state: defaultState(),
actions: {
addNewStatuses ({ rootState, commit }, { statuses, showImmediately = false, timeline = false, noIdUpdate = false, userId, pagination }) {
addNewStatuses ({ rootState, commit, dispatch, state }, { statuses, showImmediately = false, timeline = false, noIdUpdate = false, userId, pagination }) {
commit('addNewStatuses', { statuses, showImmediately, timeline, noIdUpdate, user: rootState.users.currentUser, userId, pagination })
const deletions = statuses.filter(status => status.type === 'deletion')
console.log(deletions)
},
fetchStatus ({ rootState, dispatch }, id) {
return rootState.api.backendInteractor.fetchStatus({ id })