From f04cbc887595e842ab8b9dad6545f6e409e52ea1 Mon Sep 17 00:00:00 2001 From: taehoon Date: Sun, 24 Feb 2019 03:20:11 -0500 Subject: [PATCH] Add mute/unmute mutations --- src/modules/users.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modules/users.js b/src/modules/users.js index 9c89f34a..f53245a2 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -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) => {