mirror of
https://github.com/go-gitea/gitea
synced 2025-01-21 23:24:29 +00:00
parent
2e42e96ce2
commit
46d1e91aed
@ -576,17 +576,9 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
||||
// -------------------------------
|
||||
// Fill stats to post to ctx.Data.
|
||||
// -------------------------------
|
||||
issueStats, err := getUserIssueStats(ctx, filterMode, issue_indexer.ToSearchOptions(keyword, opts).Copy(
|
||||
issueStats, err := getUserIssueStats(ctx, ctxUser, filterMode, issue_indexer.ToSearchOptions(keyword, opts).Copy(
|
||||
func(o *issue_indexer.SearchOptions) {
|
||||
o.IsFuzzyKeyword = isFuzzy
|
||||
// If the doer is the same as the context user, which means the doer is viewing his own dashboard,
|
||||
// it's not enough to show the repos that the doer owns or has been explicitly granted access to,
|
||||
// because the doer may create issues or be mentioned in any public repo.
|
||||
// So we need search issues in all public repos.
|
||||
o.AllPublic = ctx.Doer.ID == ctxUser.ID
|
||||
o.MentionID = nil
|
||||
o.ReviewRequestedID = nil
|
||||
o.ReviewedID = nil
|
||||
},
|
||||
))
|
||||
if err != nil {
|
||||
@ -775,10 +767,19 @@ func UsernameSubRoute(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func getUserIssueStats(ctx *context.Context, filterMode int, opts *issue_indexer.SearchOptions) (ret *issues_model.IssueStats, err error) {
|
||||
func getUserIssueStats(ctx *context.Context, ctxUser *user_model.User, filterMode int, opts *issue_indexer.SearchOptions) (ret *issues_model.IssueStats, err error) {
|
||||
ret = &issues_model.IssueStats{}
|
||||
doerID := ctx.Doer.ID
|
||||
|
||||
opts = opts.Copy(func(o *issue_indexer.SearchOptions) {
|
||||
// If the doer is the same as the context user, which means the doer is viewing his own dashboard,
|
||||
// it's not enough to show the repos that the doer owns or has been explicitly granted access to,
|
||||
// because the doer may create issues or be mentioned in any public repo.
|
||||
// So we need search issues in all public repos.
|
||||
o.AllPublic = doerID == ctxUser.ID
|
||||
})
|
||||
|
||||
// Open/Closed are for the tabs of the issue list
|
||||
{
|
||||
openClosedOpts := opts.Copy()
|
||||
switch filterMode {
|
||||
@ -809,6 +810,15 @@ func getUserIssueStats(ctx *context.Context, filterMode int, opts *issue_indexer
|
||||
}
|
||||
}
|
||||
|
||||
// Below stats are for the left sidebar
|
||||
opts = opts.Copy(func(o *issue_indexer.SearchOptions) {
|
||||
o.AssigneeID = nil
|
||||
o.PosterID = nil
|
||||
o.MentionID = nil
|
||||
o.ReviewRequestedID = nil
|
||||
o.ReviewedID = nil
|
||||
})
|
||||
|
||||
ret.YourRepositoriesCount, err = issue_indexer.CountIssues(ctx, opts.Copy(func(o *issue_indexer.SearchOptions) { o.AllPublic = false }))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user