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:
parent
24ff8d5d38
commit
4a99a91cc9
@ -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
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user