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:
parent
236c62abbc
commit
037e951141
3
mattermost-plugin/server/manifest.go
generated
3
mattermost-plugin/server/manifest.go
generated
@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -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{}
|
||||
|
Loading…
Reference in New Issue
Block a user