Skip to content

Commit a7ee4d5

Browse files
authored
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 <[email protected]>
1 parent 851b54b commit a7ee4d5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

models/repo_list.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ func teamUnitsRepoCond(id string, userID, orgID, teamID int64, units ...unit.Typ
244244
builder.In(
245245
"team_id", builder.Select("team_id").From("team_unit").Where(
246246
builder.Eq{
247-
"org_id": orgID,
247+
"`team_unit`.org_id": orgID,
248248
}.And(
249-
builder.In("type", units),
249+
builder.In("`team_unit`.type", units),
250250
),
251251
),
252252
),
@@ -259,8 +259,8 @@ func userCollaborationRepoCond(idStr string, userID int64) builder.Cond {
259259
return builder.In(idStr, builder.Select("repo_id").
260260
From("`access`").
261261
Where(builder.And(
262-
builder.Eq{"user_id": userID},
263-
builder.Gt{"mode": int(perm.AccessModeNone)},
262+
builder.Eq{"`access`.user_id": userID},
263+
builder.Gt{"`access`.mode": int(perm.AccessModeNone)},
264264
)),
265265
)
266266
}
@@ -289,7 +289,7 @@ func userOrgTeamUnitRepoBuilder(userID int64, unitType unit.Type) *builder.Build
289289
func userOrgUnitRepoCond(idStr string, userID, orgID int64, unitType unit.Type) builder.Cond {
290290
return builder.In(idStr,
291291
userOrgTeamUnitRepoBuilder(userID, unitType).
292-
And(builder.Eq{"org_id": orgID}),
292+
And(builder.Eq{"`team_unit`.org_id": orgID}),
293293
)
294294
}
295295

0 commit comments

Comments
 (0)