1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-11 18:13:52 +02:00

Fix issues when retrieving boards (#4145)

* update function to only retrieve boards once.

* some cleanup

* fix spelling error
This commit is contained in:
Scott Bishel 2022-11-07 11:49:19 -07:00 committed by GitHub
parent 236c62abbc
commit 037e951141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 16 deletions

View File

@ -45,7 +45,8 @@ const manifestStr = `
"type": "bool",
"help_text": "This allows board editors to share boards that can be accessed by anyone with the link.",
"placeholder": "",
"default": false
"default": false,
"hosting": ""
}
]
}

View File

@ -984,31 +984,26 @@ func (s *MattermostAuthLayer) GetMembersForBoard(boardID string) ([]*model.Board
}
func (s *MattermostAuthLayer) GetBoardsForUserAndTeam(userID, teamID string, includePublicBoards bool) ([]*model.Board, error) {
if includePublicBoards {
boards, err := s.SearchBoardsForUserInTeam(teamID, "", userID)
if err != nil {
return nil, err
}
return boards, nil
}
// retrieve only direct memberships for user
// this is usually done for guests.
members, err := s.GetMembersForUser(userID)
if err != nil {
return nil, err
}
boardIDs := []string{}
for _, m := range members {
boardIDs = append(boardIDs, m.BoardID)
}
if includePublicBoards {
var boards []*model.Board
boards, err = s.SearchBoardsForUserInTeam(teamID, "", userID)
if err != nil {
return nil, err
}
for _, b := range boards {
boardIDs = append(boardIDs, b.ID)
}
}
boards, err := s.Store.GetBoardsInTeamByIds(boardIDs, teamID)
// ToDo: check if the query is being used appropriately from the
// interface, as we're getting ID sets on request that
// return partial results that seem to be valid
if model.IsErrNotFound(err) {
if boards == nil {
boards = []*model.Board{}