Skip to content

Commit

Permalink
Some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 28, 2021
1 parent 7bd8220 commit c6d37f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1711,13 +1711,15 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {

sess := func(cond builder.Cond) *xorm.Session {
s := db.GetEngine(db.DefaultContext).Where(cond)
s.Join("INNER", "repository", "issue.repo_id = repository.id")
if len(opts.LabelIDs) > 0 {
s.Join("INNER", "issue_label", "issue_label.issue_id = issue.id").
In("issue_label.label_id", opts.LabelIDs)
}
if opts.IsArchived != util.OptionalBoolNone {
s.And(builder.Eq{"repository.is_archived": opts.IsArchived.IsTrue()})
if opts.UserID > 0 || opts.IsArchived != util.OptionalBoolNone {
s.Join("INNER", "repository", "issue.repo_id = repository.id")
if opts.IsArchived != util.OptionalBoolNone {
s.And(builder.Eq{"repository.is_archived": opts.IsArchived.IsTrue()})
}
}
return s
}
Expand Down
2 changes: 1 addition & 1 deletion models/repo_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func userOrgPublicRepoCondPrivate(userID int64) builder.Cond {
Join("INNER", "`user`", "`user`.id = `org_user`.org_id").
Where(builder.Eq{
"`org_user`.uid": userID,
"`user`.type": user_model.UserTypeOrganization,
"`user`.`type`": user_model.UserTypeOrganization,
"`user`.visibility": structs.VisibleTypePrivate,
}),
),
Expand Down

0 comments on commit c6d37f1

Please sign in to comment.