diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-05-16 09:49:17 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-16 17:49:17 +0800 |
commit | 71ca131582fff51da614291732ed43b2bf48d8a1 (patch) | |
tree | 0d7d69b3c5e2110ba00f7049e7b0bd08ef8fff75 /routers | |
parent | d494cc335633ff838eaea547438b95e753aeec0f (diff) | |
download | gitea-71ca131582fff51da614291732ed43b2bf48d8a1.tar.gz gitea-71ca131582fff51da614291732ed43b2bf48d8a1.zip |
Fix issue overview for teams (#19652)
- Don't use hacky solution to limit to the correct RepoID's, instead use
current code to handle these limits. The existing code is more correct
than the hacky solution.
- Resolves #19636
- Add test-case
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/user/home.go | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/routers/web/user/home.go b/routers/web/user/home.go index 2e7b382de6..37f6b88352 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -443,12 +443,13 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { AllLimited: false, } - if ctxUser.IsOrganization() && ctx.Org.Team != nil { - repoOpts.TeamID = ctx.Org.Team.ID + if team != nil { + repoOpts.TeamID = team.ID } switch filterMode { case models.FilterModeAll: + case models.FilterModeYourRepositories: case models.FilterModeAssign: opts.AssigneeID = ctx.Doer.ID case models.FilterModeCreate: @@ -457,13 +458,6 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { opts.MentionedID = ctx.Doer.ID case models.FilterModeReviewRequested: opts.ReviewRequestedID = ctx.Doer.ID - case models.FilterModeYourRepositories: - if ctxUser.IsOrganization() && ctx.Org.Team != nil { - // Fixes a issue whereby the user's ID would be used - // to check if it's in the team(which possible isn't the case). - opts.User = nil - } - opts.RepoCond = models.SearchRepositoryCondition(repoOpts) } // keyword holds the search term entered into the search field. @@ -595,13 +589,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { Org: org, Team: team, } - if filterMode == models.FilterModeYourRepositories { - statsOpts.RepoCond = models.SearchRepositoryCondition(repoOpts) - } - // Detect when we only should search by team. - if opts.User == nil { - statsOpts.UserID = 0 - } + issueStats, err = models.GetUserIssueStats(statsOpts) if err != nil { ctx.ServerError("GetUserIssueStats Shown", err) |