summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorjaqra <48099350+jaqra@users.noreply.github.com>2019-09-18 10:24:44 +0300
committerLauris BH <lauris@nix.lv>2019-09-18 10:24:44 +0300
commit28362195a0ecbf1f68167d5d9dee13c691079afe (patch)
tree39a7c5fe4745642d2bc89685f7953c0e8f3f9a73 /models
parent04ca7f004710de2b408f558f6f148894aa61ba57 (diff)
downloadgitea-28362195a0ecbf1f68167d5d9dee13c691079afe.tar.gz
gitea-28362195a0ecbf1f68167d5d9dee13c691079afe.zip
Add 'Mentioning you' group to /issues page (#8201)
Diffstat (limited to 'models')
-rw-r--r--models/issue.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/models/issue.go b/models/issue.go
index 511bfa31c4..87e64ce99b 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -1682,6 +1682,21 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
if err != nil {
return nil, err
}
+ case FilterModeMention:
+ stats.OpenCount, err = x.Where(cond).And("is_closed = ?", false).
+ Join("INNER", "issue_user", "issue.id = issue_user.issue_id and issue_user.is_mentioned = ?", true).
+ And("issue_user.uid = ?", opts.UserID).
+ Count(new(Issue))
+ if err != nil {
+ return nil, err
+ }
+ stats.ClosedCount, err = x.Where(cond).And("is_closed = ?", true).
+ Join("INNER", "issue_user", "issue.id = issue_user.issue_id and issue_user.is_mentioned = ?", true).
+ And("issue_user.uid = ?", opts.UserID).
+ Count(new(Issue))
+ if err != nil {
+ return nil, err
+ }
}
cond = cond.And(builder.Eq{"issue.is_closed": opts.IsClosed})
@@ -1700,6 +1715,14 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
return nil, err
}
+ stats.MentionCount, err = x.Where(cond).
+ Join("INNER", "issue_user", "issue.id = issue_user.issue_id and issue_user.is_mentioned = ?", true).
+ And("issue_user.uid = ?", opts.UserID).
+ Count(new(Issue))
+ if err != nil {
+ return nil, err
+ }
+
stats.YourRepositoriesCount, err = x.Where(cond).
And(builder.In("issue.repo_id", opts.UserRepoIDs)).
Count(new(Issue))