fix issue with deleted members not updated via websocket (#3743)

This commit is contained in:
Scott Bishel 2022-08-25 11:21:04 -06:00 committed by GitHub
parent 62ffa9c39a
commit 40045d9f7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,18 +71,18 @@ export const updateMembersEnsuringBoardsAndUsers = createAsyncThunk(
// ensure the users for the new memberships get loaded
const boardUsers = thunkAPI.getState().users.boardUsers
members.forEach(async (m) => {
const deleted = !m.schemeAdmin && !m.schemeEditor && !m.schemeViewer && !m.schemeCommenter
if (deleted) {
thunkAPI.dispatch(removeBoardUsersById([m.userId]))
return
}
if (boardUsers[m.userId]) {
return
}
const user = await client.getUser(m.userId)
if (user) {
const deleted = !m.schemeAdmin && !m.schemeEditor && !m.schemeViewer && !m.schemeCommenter
if (deleted) {
thunkAPI.dispatch(removeBoardUsersById([user.id]))
} else {
thunkAPI.dispatch(addBoardUsers([user]))
}
}
})
return members