0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-26 00:14:53 +01:00

Prevent ambiguous column error in organizations page (#18314)

Explicitly set the table for the org_id column queries on the organizations pages.

Fix #18229

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2022-01-18 07:45:14 +00:00 committed by GitHub
parent 851b54ba9f
commit a7ee4d507a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -244,9 +244,9 @@ func teamUnitsRepoCond(id string, userID, orgID, teamID int64, units ...unit.Typ
builder.In( builder.In(
"team_id", builder.Select("team_id").From("team_unit").Where( "team_id", builder.Select("team_id").From("team_unit").Where(
builder.Eq{ builder.Eq{
"org_id": orgID, "`team_unit`.org_id": orgID,
}.And( }.And(
builder.In("type", units), builder.In("`team_unit`.type", units),
), ),
), ),
), ),
@ -259,8 +259,8 @@ func userCollaborationRepoCond(idStr string, userID int64) builder.Cond {
return builder.In(idStr, builder.Select("repo_id"). return builder.In(idStr, builder.Select("repo_id").
From("`access`"). From("`access`").
Where(builder.And( Where(builder.And(
builder.Eq{"user_id": userID}, builder.Eq{"`access`.user_id": userID},
builder.Gt{"mode": int(perm.AccessModeNone)}, builder.Gt{"`access`.mode": int(perm.AccessModeNone)},
)), )),
) )
} }
@ -289,7 +289,7 @@ func userOrgTeamUnitRepoBuilder(userID int64, unitType unit.Type) *builder.Build
func userOrgUnitRepoCond(idStr string, userID, orgID int64, unitType unit.Type) builder.Cond { func userOrgUnitRepoCond(idStr string, userID, orgID int64, unitType unit.Type) builder.Cond {
return builder.In(idStr, return builder.In(idStr,
userOrgTeamUnitRepoBuilder(userID, unitType). userOrgTeamUnitRepoBuilder(userID, unitType).
And(builder.Eq{"org_id": orgID}), And(builder.Eq{"`team_unit`.org_id": orgID}),
) )
} }