From 948baba9d351f8e5958e1f1aa7b9065c9c54f026 Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 2 Apr 2019 16:23:12 -0400 Subject: [PATCH] add muted user to the mutes list in real time --- src/modules/users.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/users.js b/src/modules/users.js index 2c6a0f81..b6d8227c 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -145,6 +145,11 @@ export const mutations = { saveMuteIds (state, muteIds) { state.currentUser.muteIds = muteIds }, + addMuteId (state, muteId) { + if (state.currentUser.muteIds.indexOf(muteId) === -1) { + state.currentUser.muteIds.push(muteId) + } + }, setUserForStatus (state, status) { status.user = state.usersObject[status.user.id] }, @@ -240,7 +245,10 @@ const users = { }, muteUser (store, id) { return store.rootState.api.backendInteractor.muteUser(id) - .then((relationship) => store.commit('updateUserRelationship', [relationship])) + .then((relationship) => { + store.commit('updateUserRelationship', [relationship]) + store.commit('addMuteId', id) + }) }, unmuteUser (store, id) { return store.rootState.api.backendInteractor.unmuteUser(id)