-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Fix incorrect issue filter in user dashboard #23630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
5343ec1
085a44e
da6e7f8
0d7eecd
448d141
862c853
99458cb
97b4490
331a4e8
71b4011
b3e982f
1582bb1
33ba5c9
6415db9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -599,3 +599,50 @@ func (issues IssueList) GetApprovalCounts(ctx context.Context) (map[int64][]*Rev | |
|
|
||
| return approvalCountMap, nil | ||
| } | ||
|
|
||
| // UserAssignedIssueCond return user as assignee issues list | ||
| func UserAssignedIssueCond(userID int64) builder.Cond { | ||
| return builder.And( | ||
| builder.Eq{ | ||
| "repository.is_private": false, | ||
| }, | ||
| builder.In("issue.id", | ||
| builder.Select("issue_assignees.issue_id").From("issue_assignees"). | ||
| Where(builder.Eq{ | ||
| "issue_assignees.assignee_id": userID, | ||
| }), | ||
| ), | ||
| ) | ||
| } | ||
|
|
||
| // UserMentionedIssueCond return user metinoed issues list | ||
| func UserMentionedIssueCond(userID int64) builder.Cond { | ||
| return builder.And( | ||
| builder.Eq{ | ||
| "repository.is_private": false, | ||
| }, | ||
| builder.In("issue.id", | ||
| builder.Select("issue_user.issue_id").From("issue_user"). | ||
| Where(builder.Eq{ | ||
| "issue_user.is_mentioned": true, | ||
| "issue_user.uid": userID, | ||
| }), | ||
| ), | ||
| ) | ||
| } | ||
|
|
||
| // UserCreateIssueCond return user created issues list | ||
| func UserCreateIssueCond(userID int64, isPull bool) builder.Cond { | ||
| return builder.And( | ||
| builder.Eq{ | ||
| "repository.is_private": false, | ||
| }, | ||
| builder.In("issue.id", | ||
| builder.Select("issue.id").From("issue"). | ||
| Where(builder.Eq{ | ||
| "issue.poster_id": userID, | ||
| "issue.is_pull": isPull, | ||
| }), | ||
| ), | ||
| ) | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference between these functions and the ones in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The functions in The difference is that the functions in |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -459,21 +459,6 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { | |
| repoOpts.TeamID = team.ID | ||
| } | ||
|
|
||
| switch filterMode { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know whether we need to remove |
||
| case issues_model.FilterModeAll: | ||
| case issues_model.FilterModeYourRepositories: | ||
| case issues_model.FilterModeAssign: | ||
| opts.AssigneeID = ctx.Doer.ID | ||
| case issues_model.FilterModeCreate: | ||
| opts.PosterID = ctx.Doer.ID | ||
| case issues_model.FilterModeMention: | ||
| opts.MentionedID = ctx.Doer.ID | ||
| case issues_model.FilterModeReviewRequested: | ||
| opts.ReviewRequestedID = ctx.Doer.ID | ||
| case issues_model.FilterModeReviewed: | ||
| opts.ReviewedID = ctx.Doer.ID | ||
| } | ||
|
|
||
| // keyword holds the search term entered into the search field. | ||
| keyword := strings.Trim(ctx.FormString("q"), " ") | ||
| ctx.Data["Keyword"] = keyword | ||
|
|
@@ -514,6 +499,23 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { | |
| } | ||
| } | ||
|
|
||
| // In order to display all issues count in repo filter, | ||
| // we need to check filterMode after CountIssuesByRepo | ||
| switch filterMode { | ||
| case issues_model.FilterModeAll: | ||
| case issues_model.FilterModeYourRepositories: | ||
| case issues_model.FilterModeAssign: | ||
| opts.AssigneeID = ctx.Doer.ID | ||
| case issues_model.FilterModeCreate: | ||
| opts.PosterID = ctx.Doer.ID | ||
| case issues_model.FilterModeMention: | ||
| opts.MentionedID = ctx.Doer.ID | ||
| case issues_model.FilterModeReviewRequested: | ||
| opts.ReviewRequestedID = ctx.Doer.ID | ||
| case issues_model.FilterModeReviewed: | ||
| opts.ReviewedID = ctx.Doer.ID | ||
| } | ||
|
|
||
| // Make sure page number is at least 1. Will be posted to ctx.Data. | ||
| page := ctx.FormInt("page") | ||
| if page <= 1 { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.