From d7919109ec30c5a75690d6c5b26f1ecebe74d7bf Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sat, 2 Mar 2019 08:20:56 -0500
Subject: [PATCH] Reset statusnet_blocking of all fetched users first while
refreshing block list
---
src/modules/users.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/modules/users.js b/src/modules/users.js
index 79046371..dd729410 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -102,6 +102,11 @@ export const mutations = {
}
})
},
+ updateBlocks (state, blockedUsers) {
+ // Reset statusnet_blocking of all fetched users
+ each(state.users, (user) => { user.statusnet_blocking = false })
+ each(blockedUsers, (user) => mergeOrAdd(state.users, state.usersObject, user))
+ },
saveBlockIds (state, blockIds) {
state.currentUser.blockIds = blockIds
},
@@ -187,7 +192,7 @@ const users = {
return store.rootState.api.backendInteractor.fetchBlocks()
.then((blocks) => {
store.commit('saveBlockIds', map(blocks, 'id'))
- store.commit('addNewUsers', blocks)
+ store.commit('updateBlocks', blocks)
return blocks
})
},