From 63ad2f4524fb5f984769275734e3be1beee4d400 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 28 May 2020 21:15:58 +0300 Subject: [PATCH] Fix reactivity flow for user moderation from status show page --- src/store/modules/status.js | 10 ++++++++++ src/store/modules/users.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/store/modules/status.js b/src/store/modules/status.js index f8e52288..724a0dd0 100644 --- a/src/store/modules/status.js +++ b/src/store/modules/status.js @@ -95,6 +95,12 @@ const status = { commit('SET_LOADING', false) dispatch('FetchUserStatuses', { userId: state.fetchedStatus.account.id, godmode: false }) }, + FetchStatusAfterUserModeration({ commit, dispatch, getters, state }, id) { + commit('SET_LOADING', true) + fetchStatus(id, getters.authHost, getters.token) + .then((status) => dispatch('SetStatus', status.data)) + commit('SET_LOADING', false) + }, async FetchStatusesCount({ commit, getters }, instance) { commit('SET_LOADING', true) const { data } = await fetchStatusesCount(instance, getters.authHost, getters.token) @@ -178,6 +184,10 @@ const status = { }, HandlePageChange({ commit }, page) { commit('CHANGE_PAGE', page) + }, + SetStatus({ commit }, status) { + commit('SET_STATUS', status) + commit('SET_STATUS_AUTHOR', status.account) } } } diff --git a/src/store/modules/users.js b/src/store/modules/users.js index e86bcd49..571f018a 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -97,7 +97,7 @@ const users = { dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage }) } if (statusId) { - dispatch('FetchStatus', statusId) + dispatch('FetchStatusAfterUserModeration', statusId) } else if (userId) { dispatch('FetchUserProfile', { userId, godmode: false }) }