1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-08 15:06:08 +02:00

Displayed only board members in autocomplete (#2969)

* Displayed only board members in autocomplete

* Removed debug logs
This commit is contained in:
Harshil Sharma 2022-05-04 00:24:47 +05:30 committed by GitHub
parent 24ff8d5d38
commit 4a99a91cc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ import {IUser} from '../user'
import {initialLoad, initialReadOnlyLoad, loadBoardData} from './initialLoad'
import {addBoardUsers} from './users'
import {addBoardUsers, setBoardUsers} from './users'
import {RootState} from './index'
@ -26,22 +26,19 @@ export const fetchBoardMembers = createAsyncThunk(
'boardMembers/fetch',
async ({teamId, boardId}: {teamId: string, boardId: string}, thunkAPI: any) => {
const members = await client.getBoardMembers(teamId, boardId)
const boardUsers = thunkAPI.getState().users.boardUsers as {[key: string]: IUser}
const newUsers = [] as IUser[]
const users = [] as IUser[]
/* eslint-disable no-await-in-loop */
for (const member of members) {
const memberFromStore = boardUsers[member.userId]
if (!memberFromStore) {
const user = await client.getUser(member.userId)
if (user) {
newUsers.push(user)
}
// TODO #2968 we should fetch this in bulk
const user = await client.getUser(member.userId)
if (user) {
users.push(user)
}
}
/* eslint-enable no-await-in-loop */
thunkAPI.dispatch(addBoardUsers(newUsers))
thunkAPI.dispatch(setBoardUsers(users))
return members
},
)