mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-26 18:48:15 +02:00
Fixed a bug where rmeoved board members showed up in comment list (#3223)
* Fixed a bug where rmeoved board members showed up in comment list * Review fixes
This commit is contained in:
parent
d414d5cc5e
commit
b5d8f2b9e1
@ -28,6 +28,7 @@ import {updateViews} from './store/views'
|
||||
import {updateCards} from './store/cards'
|
||||
import {updateComments} from './store/comments'
|
||||
import {updateContents} from './store/contents'
|
||||
import {addBoardUsers, removeBoardUsersById} from "./store/users"
|
||||
|
||||
function updateAllBoardsAndBlocks(boards: Board[], blocks: Block[]) {
|
||||
return batch(() => {
|
||||
@ -384,9 +385,14 @@ class Mutator {
|
||||
await undoManager.perform(
|
||||
async () => {
|
||||
await octoClient.deleteBoardMember(member)
|
||||
store.dispatch(removeBoardUsersById([member.userId]))
|
||||
},
|
||||
async () => {
|
||||
await octoClient.createBoardMember(member)
|
||||
const user = await octoClient.getUser(member.userId)
|
||||
if (user) {
|
||||
store.dispatch(addBoardUsers([user]))
|
||||
}
|
||||
},
|
||||
description,
|
||||
this.undoGroupId,
|
||||
|
@ -9,7 +9,7 @@ import {IUser} from '../user'
|
||||
|
||||
import {initialLoad, initialReadOnlyLoad, loadBoardData} from './initialLoad'
|
||||
|
||||
import {addBoardUsers, setBoardUsers} from './users'
|
||||
import {addBoardUsers, removeBoardUsersById, setBoardUsers} from './users'
|
||||
|
||||
import {RootState} from './index'
|
||||
|
||||
@ -81,7 +81,12 @@ export const updateMembersEnsuringBoardsAndUsers = createAsyncThunk(
|
||||
}
|
||||
const user = await client.getUser(m.userId)
|
||||
if (user) {
|
||||
thunkAPI.dispatch(addBoardUsers([user]))
|
||||
const deleted = !m.schemeAdmin && !m.schemeEditor && !m.schemeViewer && !m.schemeCommenter
|
||||
if (deleted) {
|
||||
thunkAPI.dispatch(removeBoardUsersById([user.id]))
|
||||
} else {
|
||||
thunkAPI.dispatch(addBoardUsers([user]))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -60,6 +60,11 @@ const usersSlice = createSlice({
|
||||
state.boardUsers[user.id] = user
|
||||
})
|
||||
},
|
||||
removeBoardUsersById: (state, action: PayloadAction<string[]>) => {
|
||||
action.payload.forEach((userId: string) => {
|
||||
delete state.boardUsers[userId]
|
||||
})
|
||||
},
|
||||
followBlock: (state, action: PayloadAction<Subscription>) => {
|
||||
state.blockSubscriptions.push(action.payload)
|
||||
},
|
||||
@ -97,7 +102,7 @@ const usersSlice = createSlice({
|
||||
},
|
||||
})
|
||||
|
||||
export const {setMe, setBoardUsers, addBoardUsers, followBlock, unfollowBlock, patchProps} = usersSlice.actions
|
||||
export const {setMe, setBoardUsers, removeBoardUsersById, addBoardUsers, followBlock, unfollowBlock, patchProps} = usersSlice.actions
|
||||
export const {reducer} = usersSlice
|
||||
|
||||
export const getMe = (state: RootState): IUser|null => state.users.me
|
||||
|
Loading…
x
Reference in New Issue
Block a user