fix issue with deleted members not updated via websocket (#3743)
This commit is contained in:
parent
62ffa9c39a
commit
40045d9f7b
1 changed files with 6 additions and 6 deletions
|
@ -71,18 +71,18 @@ export const updateMembersEnsuringBoardsAndUsers = createAsyncThunk(
|
||||||
// ensure the users for the new memberships get loaded
|
// ensure the users for the new memberships get loaded
|
||||||
const boardUsers = thunkAPI.getState().users.boardUsers
|
const boardUsers = thunkAPI.getState().users.boardUsers
|
||||||
members.forEach(async (m) => {
|
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]) {
|
if (boardUsers[m.userId]) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const user = await client.getUser(m.userId)
|
const user = await client.getUser(m.userId)
|
||||||
if (user) {
|
if (user) {
|
||||||
const deleted = !m.schemeAdmin && !m.schemeEditor && !m.schemeViewer && !m.schemeCommenter
|
|
||||||
if (deleted) {
|
|
||||||
thunkAPI.dispatch(removeBoardUsersById([user.id]))
|
|
||||||
} else {
|
|
||||||
thunkAPI.dispatch(addBoardUsers([user]))
|
thunkAPI.dispatch(addBoardUsers([user]))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return members
|
return members
|
||||||
|
|
Loading…
Reference in a new issue