Add mute/unmute mutations

This commit is contained in:
taehoon 2019-02-24 03:20:11 -05:00
parent 3255950b0e
commit f04cbc8875

View file

@ -108,6 +108,14 @@ export const mutations = {
saveMutes (state, muteIds) {
state.currentUser.muteIds = muteIds
},
muteUser (state, id) {
const user = state.usersObject[id]
set(user, 'mastodonMuted', true)
},
unmuteUser (state, id) {
const user = state.usersObject[id]
set(user, 'mastodonMuted', false)
},
setUserForStatus (state, status) {
status.user = state.usersObject[status.user.id]
},
@ -200,19 +208,11 @@ const users = {
},
muteUser (store, id) {
return store.rootState.api.backendInteractor.muteUser(id)
.then(() => {
const user = store.rootState.users.usersObject[id]
set(user, 'mastodonMuted', true)
store.commit('addNewUsers', [user])
})
.then(() => store.commit('muteUser', id))
},
unmuteUser (store, id) {
return store.rootState.api.backendInteractor.unmuteUser(id)
.then(() => {
const user = store.rootState.users.usersObject[id]
set(user, 'mastodonMuted', false)
store.commit('addNewUsers', [user])
})
.then(() => store.commit('unmuteUser', id))
},
addFriends ({ rootState, commit }, fetchBy) {
return new Promise((resolve, reject) => {