From 098858dc6474c0f16928bf55ee29d49123358798 Mon Sep 17 00:00:00 2001 From: Dominik Rimpf Date: Fri, 30 Aug 2024 03:27:42 +0200 Subject: [PATCH] fix: do not show same group multiple times --- database/group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/group.go b/database/group.go index fe57b2e..4b5f5df 100644 --- a/database/group.go +++ b/database/group.go @@ -101,7 +101,7 @@ func GetGroupsAUserIsAMemberOf(UserID uuid.UUID) ([]models.Group, error) { var groups []models.Group // Retrieve groups that the user is a member of - groupRecords := Instance. + groupRecords := Instance.Distinct(). Where(&models.Group{Enabled: true}). Joins("JOIN group_memberships ON group_memberships.group_id = groups.id", Instance.Where(&models.GroupMembership{Enabled: true, MemberID: UserID})). Find(&groups)