1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-01 09:51:39 -05:00

Add 'Mentioning you' group to /issues page (#8201)

This commit is contained in:
jaqra 2019-09-18 10:24:44 +03:00 committed by Lauris BH
parent 04ca7f0047
commit 28362195a0
3 changed files with 29 additions and 0 deletions

View file

@ -1682,6 +1682,21 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
if err != nil { if err != nil {
return nil, err 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}) cond = cond.And(builder.Eq{"issue.is_closed": opts.IsClosed})
@ -1700,6 +1715,14 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
return nil, err 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). stats.YourRepositoriesCount, err = x.Where(cond).
And(builder.In("issue.repo_id", opts.UserRepoIDs)). And(builder.In("issue.repo_id", opts.UserRepoIDs)).
Count(new(Issue)) Count(new(Issue))

View file

@ -181,6 +181,8 @@ func Issues(ctx *context.Context) {
filterMode = models.FilterModeAssign filterMode = models.FilterModeAssign
case "created_by": case "created_by":
filterMode = models.FilterModeCreate filterMode = models.FilterModeCreate
case "mentioned":
filterMode = models.FilterModeMention
case "all": // filterMode already set to All case "all": // filterMode already set to All
default: default:
viewType = "all" viewType = "all"

View file

@ -18,6 +18,10 @@
{{.i18n.Tr "repo.issues.filter_type.created_by_you"}} {{.i18n.Tr "repo.issues.filter_type.created_by_you"}}
<strong class="ui right">{{.IssueStats.CreateCount}}</strong> <strong class="ui right">{{.IssueStats.CreateCount}}</strong>
</a> </a>
<a class="{{if eq .ViewType "mentioned"}}ui basic blue button{{end}} item" href="{{.Link}}?type=mentioned&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
{{.i18n.Tr "repo.issues.filter_type.mentioning_you"}}
<strong class="ui right">{{.IssueStats.MentionCount}}</strong>
</a>
{{end}} {{end}}
<div class="ui divider"></div> <div class="ui divider"></div>
{{range .Repos}} {{range .Repos}}