Skip to content

Add issue filter for Author #20578

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

Merged
merged 13 commits into from
Aug 8, 2022
Prev Previous commit
Next Next commit
Fix GetPosters to work with issues
I forgot to consider that this function was also being used for issue pages, so this now allows both issues and PRs to be handled.
  • Loading branch information
parnic committed Aug 7, 2022
commit d45fbce7c57eb1b49545f45bd7095b092b36148d
6 changes: 3 additions & 3 deletions models/repo/user_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ func GetReviewers(ctx context.Context, repo *Repository, doerID, posterID int64)
return users, db.GetEngine(ctx).Where(cond).OrderBy(user_model.GetOrderByName()).Find(&users)
}

// GetPullRequestPosters returns all users that have authored a pull request for the given repository
func GetPullRequestPosters(ctx context.Context, repo *Repository) ([]*user_model.User, error) {
// GetIssuePosters returns all users that have authored a pull request for the given repository
func GetIssuePosters(ctx context.Context, repo *Repository, isPull bool) ([]*user_model.User, error) {
users := make([]*user_model.User, 0, 8)
cond := builder.In("`user`.id",
builder.Select("poster_id").From("issue").Where(
builder.Eq{"repo_id": repo.ID}.
And(builder.Eq{"is_pull": true}),
And(builder.Eq{"is_pull": isPull}),
).GroupBy("poster_id"),
)
return users, db.GetEngine(ctx).Where(cond).OrderBy(user_model.GetOrderByName()).Find(&users)
Expand Down
2 changes: 1 addition & 1 deletion routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
return
}

ctx.Data["Posters"], err = repo_model.GetPullRequestPosters(ctx, repo)
ctx.Data["Posters"], err = repo_model.GetIssuePosters(ctx, repo, isPullOption.IsTrue())
if err != nil {
ctx.ServerError("GetPullRequestPosters", err)
return
Expand Down