Skip to content

Commit 829bbd1

Browse files
committed
Add created_by filter to SearchIssues
This patch adds the created_by filter to the SearchIssues method. tea cli has an option to filter by author when listing issues, but it's not working. The tea command line creates this request for the API when using the author filter: $ tea issue list -l local --kind pull -A danigm -vvv http://localhost:3000/api/v1/repos/issues/search?created_by=danigm&labels=&limit=30&milestones=&page=1&state=open&type=pulls This patch fixes the API to allow this kind of queries from go-sdk and tea cli.
1 parent b9d323c commit 829bbd1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

routers/api/v1/repo/issue.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ func SearchIssues(ctx *context.APIContext) {
157157
// in: query
158158
// description: Filter by repository owner
159159
// type: string
160+
// - name: created_by
161+
// in: query
162+
// description: Only show items which were created by the given user
163+
// type: string
160164
// - name: team
161165
// in: query
162166
// description: Filter by team (requires organization owner parameter)
@@ -257,6 +261,14 @@ func SearchIssues(ctx *context.APIContext) {
257261
searchOpt.UpdatedBeforeUnix = optional.Some(before)
258262
}
259263

264+
createdByID := getUserIDForFilter(ctx, "created_by")
265+
if ctx.Written() {
266+
return
267+
}
268+
if createdByID > 0 {
269+
searchOpt.PosterID = strconv.FormatInt(createdByID, 10)
270+
}
271+
260272
if ctx.IsSigned {
261273
ctxUserID := ctx.Doer.ID
262274
if ctx.FormBool("created") {

templates/swagger/v1_json.tmpl

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)