Skip to content

Commit

Permalink
moved user.IsGuest check before fetching implicits board members
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat-Dabade committed Nov 19, 2024
1 parent b37004e commit f6892d8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions server/services/store/sqlstore/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,14 @@ func (s *SQLStore) getMembersForUser(db sq.BaseRunner, userID string) ([]*model.
return nil, err
}

user, err := s.GetUserByID(userID)
if err != nil {
return nil, err
}
if user.IsGuest {
return explicitMembers, nil
}

newQuery := s.getQueryBuilder(db).
Select("CM.userID, B.Id").
From(s.tablePrefix + "boards AS B").
Expand All @@ -705,15 +713,6 @@ func (s *SQLStore) getMembersForUser(db sq.BaseRunner, userID string) ([]*model.
existingMembers[m.BoardID] = true
}

// No synthetic memberships for guests
user, err := s.GetUserByID(userID)
if err != nil {
return nil, err
}
if user.IsGuest {
return members, nil
}

implicitMembers, err := s.implicitBoardMembershipsFromRows(rows)
if err != nil {
return nil, err
Expand Down

0 comments on commit f6892d8

Please sign in to comment.