MM-25737: Fix for groups list not returning results. (#14746)

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Martin Kraft
2020-06-04 11:31:07 -04:00
коммит произвёл GitHub
родитель ca8a67c7cb
Коммит 18ddae2c1b
2 изменённых файлов: 45 добавлений и 2 удалений

Просмотреть файл

@@ -1225,7 +1225,16 @@ func (s *SqlGroupStore) GetGroups(page, perPage int, opts model.GroupSearchOpts)
if opts.FilterParentTeamPermitted && len(opts.NotAssociatedToChannel) == 26 {
groupsQuery = groupsQuery.Where(`
g.Id IN (
CASE
WHEN (
SELECT
Teams.GroupConstrained
FROM
Teams
JOIN Channels ON Channels.TeamId = Teams.Id
WHERE
Channels.Id = ?
) THEN g.Id IN (
SELECT
GroupId
FROM
@@ -1241,7 +1250,9 @@ func (s *SqlGroupStore) GetGroups(page, perPage int, opts model.GroupSearchOpts)
Id = ?
)
)
`, opts.NotAssociatedToChannel)
ELSE TRUE
END
`, opts.NotAssociatedToChannel, opts.NotAssociatedToChannel)
}
queryString, args, err := groupsQuery.ToSql()