Fix owner field being null for user shared namespaces (#119)

This commit is contained in:
konrad 2020-01-09 19:24:08 +00:00
parent a0c5e4e985
commit 1d2cdf0fb8

View file

@ -181,9 +181,11 @@ func (n *Namespace) ReadAll(a web.Auth, search string, page int, perPage int) (r
Table("namespaces"). Table("namespaces").
Join("LEFT", "team_namespaces", "namespaces.id = team_namespaces.namespace_id"). Join("LEFT", "team_namespaces", "namespaces.id = team_namespaces.namespace_id").
Join("LEFT", "team_members", "team_members.team_id = team_namespaces.team_id"). Join("LEFT", "team_members", "team_members.team_id = team_namespaces.team_id").
Join("LEFT", "users_namespace", "users_namespace.namespace_id = namespaces.id").
Join("INNER", "users", "users.id = namespaces.owner_id"). Join("INNER", "users", "users.id = namespaces.owner_id").
Where("team_members.user_id = ?", doer.ID). Where("team_members.user_id = ?", doer.ID).
Or("namespaces.owner_id = ?", doer.ID). Or("namespaces.owner_id = ?", doer.ID).
Or("users_namespace.user_id = ?", doer.ID).
GroupBy("users.id"). GroupBy("users.id").
Find(&users) Find(&users)