logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 6ed2cb8f436bca1e1cd4c40a0a2df0e96fb5d149
parent aad3225d25460170a8dd48f8ffcbc63f99a28b7f
Author: Henry Jameson <me@hjkos.com>
Date:   Thu, 16 Nov 2023 20:09:16 +0200

continue refactor

Diffstat:

Msrc/modules/notifications.js8++------
Msrc/modules/statuses.js9+++------
2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/modules/notifications.js b/src/modules/notifications.js @@ -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 }) diff --git a/src/modules/statuses.js b/src/modules/statuses.js @@ -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 })