add blocked user to the blocked list on real time

This commit is contained in:
taehoon 2019-04-02 14:56:37 -04:00
parent 9184435887
commit 5c2c222252

View file

@ -132,6 +132,11 @@ export const mutations = {
saveBlockIds (state, blockIds) { saveBlockIds (state, blockIds) {
state.currentUser.blockIds = blockIds state.currentUser.blockIds = blockIds
}, },
addBlockId (state, blockId) {
if (state.currentUser.blockIds.indexOf(blockId) === -1) {
state.currentUser.blockIds.push(blockId)
}
},
updateMutes (state, mutedUsers) { updateMutes (state, mutedUsers) {
// Reset muted of all fetched users // Reset muted of all fetched users
each(state.users, (user) => { user.muted = false }) each(state.users, (user) => { user.muted = false })
@ -215,6 +220,7 @@ const users = {
return store.rootState.api.backendInteractor.blockUser(userId) return store.rootState.api.backendInteractor.blockUser(userId)
.then((relationship) => { .then((relationship) => {
store.commit('updateUserRelationship', [relationship]) store.commit('updateUserRelationship', [relationship])
store.commit('addBlockId', userId)
store.commit('removeStatus', { timeline: 'friends', userId }) store.commit('removeStatus', { timeline: 'friends', userId })
store.commit('removeStatus', { timeline: 'public', userId }) store.commit('removeStatus', { timeline: 'public', userId })
store.commit('removeStatus', { timeline: 'publicAndExternal', userId }) store.commit('removeStatus', { timeline: 'publicAndExternal', userId })