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

Check on GetBoardsForUserAndTeam if the board result list is incomplete and continue if that's the case (#3842)

* Check on GetBoardsForUserAndTeam if the board result list is incomplete and continue if that's the case

* Remove template filter and correctly check for not founds
This commit is contained in:
Miguel de la Cruz 2022-09-14 14:59:39 +02:00 committed by GitHub
parent 6f35ed8678
commit 9163e4cd9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -910,6 +910,15 @@ func (s *MattermostAuthLayer) GetBoardsForUserAndTeam(userID, teamID string, inc
}
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{}
}
return boards, nil
}
if err != nil {
return nil, err
}

View File

@ -279,7 +279,6 @@ func (s *SQLStore) getBoardsInTeamByIds(db sq.BaseRunner, boardIDs []string, tea
Select(boardFields("b.")...).
From(s.tablePrefix + "boards as b").
Where(sq.Eq{"b.team_id": teamID}).
Where(sq.Eq{"b.is_template": false}).
Where(sq.Eq{"b.id": boardIDs})
rows, err := query.Query()
@ -299,10 +298,7 @@ func (s *SQLStore) getBoardsInTeamByIds(db sq.BaseRunner, boardIDs []string, tea
mlog.Int("len(boards)", len(boards)),
mlog.Int("len(boardIDs)", len(boardIDs)),
)
// ToDo: Don't return an error until the query above is fixed to return exactly the same
// number of boards as the ids passed in.
// Wiggin77 thinks the ids list includes templates and this query does not.
// return boards, model.NewErrNotAllFound("board", boardIDs)
return boards, model.NewErrNotAllFound("board", boardIDs)
}
return boards, nil

View File

@ -242,7 +242,6 @@ func testGetBoardsInTeamByIds(t *testing.T, store store.Store) {
ExpectedError bool
ExpectedLen int
}{
/* ToDo: uncomment when getBoardsinTeamsByIds is fixed
{
Name: "if none of the IDs are found",
BoardIDs: []string{"nonexistent-1", "nonexistent-2"},
@ -255,7 +254,6 @@ func testGetBoardsInTeamByIds(t *testing.T, store store.Store) {
ExpectedError: true,
ExpectedLen: 1,
},
*/
{
Name: "if all of the IDs are found",
BoardIDs: []string{"board-id-1", "board-id-2"},