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:
parent
6f35ed8678
commit
9163e4cd9b
@ -910,6 +910,15 @@ func (s *MattermostAuthLayer) GetBoardsForUserAndTeam(userID, teamID string, inc
|
|||||||
}
|
}
|
||||||
|
|
||||||
boards, err := s.Store.GetBoardsInTeamByIds(boardIDs, teamID)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,6 @@ func (s *SQLStore) getBoardsInTeamByIds(db sq.BaseRunner, boardIDs []string, tea
|
|||||||
Select(boardFields("b.")...).
|
Select(boardFields("b.")...).
|
||||||
From(s.tablePrefix + "boards as b").
|
From(s.tablePrefix + "boards as b").
|
||||||
Where(sq.Eq{"b.team_id": teamID}).
|
Where(sq.Eq{"b.team_id": teamID}).
|
||||||
Where(sq.Eq{"b.is_template": false}).
|
|
||||||
Where(sq.Eq{"b.id": boardIDs})
|
Where(sq.Eq{"b.id": boardIDs})
|
||||||
|
|
||||||
rows, err := query.Query()
|
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(boards)", len(boards)),
|
||||||
mlog.Int("len(boardIDs)", len(boardIDs)),
|
mlog.Int("len(boardIDs)", len(boardIDs)),
|
||||||
)
|
)
|
||||||
// ToDo: Don't return an error until the query above is fixed to return exactly the same
|
return boards, model.NewErrNotAllFound("board", boardIDs)
|
||||||
// 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, nil
|
return boards, nil
|
||||||
|
@ -242,7 +242,6 @@ func testGetBoardsInTeamByIds(t *testing.T, store store.Store) {
|
|||||||
ExpectedError bool
|
ExpectedError bool
|
||||||
ExpectedLen int
|
ExpectedLen int
|
||||||
}{
|
}{
|
||||||
/* ToDo: uncomment when getBoardsinTeamsByIds is fixed
|
|
||||||
{
|
{
|
||||||
Name: "if none of the IDs are found",
|
Name: "if none of the IDs are found",
|
||||||
BoardIDs: []string{"nonexistent-1", "nonexistent-2"},
|
BoardIDs: []string{"nonexistent-1", "nonexistent-2"},
|
||||||
@ -255,7 +254,6 @@ func testGetBoardsInTeamByIds(t *testing.T, store store.Store) {
|
|||||||
ExpectedError: true,
|
ExpectedError: true,
|
||||||
ExpectedLen: 1,
|
ExpectedLen: 1,
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
Name: "if all of the IDs are found",
|
Name: "if all of the IDs are found",
|
||||||
BoardIDs: []string{"board-id-1", "board-id-2"},
|
BoardIDs: []string{"board-id-1", "board-id-2"},
|
||||||
|
Loading…
Reference in New Issue
Block a user