diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-03-23 23:57:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 23:57:09 +0100 |
commit | a5f289407149e0c75973b7efc8e8cfd239e6dd9d (patch) | |
tree | 06e9aeebcd55eb7e33b1cc614f761920aa3d1c64 /models | |
parent | f7883a6aecb02937b09ac4576a92f7a22c84ac59 (diff) | |
download | gitea-a5f289407149e0c75973b7efc8e8cfd239e6dd9d.tar.gz gitea-a5f289407149e0c75973b7efc8e8cfd239e6dd9d.zip |
Fix showing issues in your repositories (#18916)
- Make a restriction on which issues can be shown based on if you the user or team has write permission to the repository.
- Fixes a issue whereby you wouldn't see any associated issues with a specific team on a organization if you wasn't a member(fixed by zeroing the User{ID} in the options).
- Resolves #18913
Diffstat (limited to 'models')
-rw-r--r-- | models/issue.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/models/issue.go b/models/issue.go index 53ee585dc0..79771ce15c 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1603,6 +1603,7 @@ const ( FilterModeCreate FilterModeMention FilterModeReviewRequested + FilterModeYourRepositories ) func parseCountResult(results []map[string][]byte) int64 { @@ -1747,6 +1748,7 @@ type UserIssueStatsOptions struct { IssueIDs []int64 IsArchived util.OptionalBool LabelIDs []int64 + RepoCond builder.Cond Org *Organization Team *Team } @@ -1764,6 +1766,9 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) { if len(opts.IssueIDs) > 0 { cond = cond.And(builder.In("issue.id", opts.IssueIDs)) } + if opts.RepoCond != nil { + cond = cond.And(opts.RepoCond) + } if opts.UserID > 0 { cond = cond.And(issuePullAccessibleRepoCond("issue.repo_id", opts.UserID, opts.Org, opts.Team, opts.IsPull)) @@ -1785,7 +1790,7 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) { } switch opts.FilterMode { - case FilterModeAll: + case FilterModeAll, FilterModeYourRepositories: stats.OpenCount, err = sess(cond). And("issue.is_closed = ?", false). Count(new(Issue)) |