fix(teams): fix duplicate teams being shown when new public team visibility feature is enabled (#2187)
Due to the `INNER JOIN` on the `team_members` table and the new `OR` conditions allowing teams with the `isPublic` flag set to `true`, teams are returned multiple times. As we're only after the teams, a simple distinct query should fix the issue. Co-authored-by: Daniel Herrmann <daniel.herrmann1@gmail.com> Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2187 Co-authored-by: waza-ari <daniel.herrmann@makerspace-darmstadt.de> Co-committed-by: waza-ari <daniel.herrmann@makerspace-darmstadt.de>
This commit is contained in:
parent
0057ac5836
commit
6c98052176
@ -296,7 +296,7 @@ func (t *Team) ReadAll(s *xorm.Session, a web.Auth, search string, page int, per
|
||||
limit, start := getLimitFromPageIndex(page, perPage)
|
||||
all := []*Team{}
|
||||
|
||||
query := s.Select("teams.*").
|
||||
query := s.Distinct("teams.*").
|
||||
Table("teams").
|
||||
Join("INNER", "team_members", "team_members.team_id = teams.id").
|
||||
Where(db.ILIKE("teams.name", search))
|
||||
|
Loading…
x
Reference in New Issue
Block a user