mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-25 17:45:55 +02:00
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.
This commit is contained in:
parent
b9d323c3d8
commit
829bbd1389
@ -157,6 +157,10 @@ func SearchIssues(ctx *context.APIContext) {
|
||||
// in: query
|
||||
// description: Filter by repository owner
|
||||
// type: string
|
||||
// - name: created_by
|
||||
// in: query
|
||||
// description: Only show items which were created by the given user
|
||||
// type: string
|
||||
// - name: team
|
||||
// in: query
|
||||
// description: Filter by team (requires organization owner parameter)
|
||||
@ -257,6 +261,14 @@ func SearchIssues(ctx *context.APIContext) {
|
||||
searchOpt.UpdatedBeforeUnix = optional.Some(before)
|
||||
}
|
||||
|
||||
createdByID := getUserIDForFilter(ctx, "created_by")
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
if createdByID > 0 {
|
||||
searchOpt.PosterID = strconv.FormatInt(createdByID, 10)
|
||||
}
|
||||
|
||||
if ctx.IsSigned {
|
||||
ctxUserID := ctx.Doer.ID
|
||||
if ctx.FormBool("created") {
|
||||
|
||||
6
templates/swagger/v1_json.tmpl
generated
6
templates/swagger/v1_json.tmpl
generated
@ -4300,6 +4300,12 @@
|
||||
"name": "owner",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Only show items which were created by the given user",
|
||||
"name": "created_by",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Filter by team (requires organization owner parameter)",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user