add muted user to the mutes list in real time

This commit is contained in:
taehoon 2019-04-02 16:23:12 -04:00
parent d58e08cf52
commit 948baba9d3

View file

@ -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)