mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Refactor to use optional.Option for issue index search option (#29739)
Signed-off-by: 6543 <6543@obermui.de>
This commit is contained in:
@ -269,28 +269,28 @@ func SearchIssues(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
if since != 0 {
|
||||
searchOpt.UpdatedAfterUnix = &since
|
||||
searchOpt.UpdatedAfterUnix = optional.Some(since)
|
||||
}
|
||||
if before != 0 {
|
||||
searchOpt.UpdatedBeforeUnix = &before
|
||||
searchOpt.UpdatedBeforeUnix = optional.Some(before)
|
||||
}
|
||||
|
||||
if ctx.IsSigned {
|
||||
ctxUserID := ctx.Doer.ID
|
||||
if ctx.FormBool("created") {
|
||||
searchOpt.PosterID = &ctxUserID
|
||||
searchOpt.PosterID = optional.Some(ctxUserID)
|
||||
}
|
||||
if ctx.FormBool("assigned") {
|
||||
searchOpt.AssigneeID = &ctxUserID
|
||||
searchOpt.AssigneeID = optional.Some(ctxUserID)
|
||||
}
|
||||
if ctx.FormBool("mentioned") {
|
||||
searchOpt.MentionID = &ctxUserID
|
||||
searchOpt.MentionID = optional.Some(ctxUserID)
|
||||
}
|
||||
if ctx.FormBool("review_requested") {
|
||||
searchOpt.ReviewRequestedID = &ctxUserID
|
||||
searchOpt.ReviewRequestedID = optional.Some(ctxUserID)
|
||||
}
|
||||
if ctx.FormBool("reviewed") {
|
||||
searchOpt.ReviewedID = &ctxUserID
|
||||
searchOpt.ReviewedID = optional.Some(ctxUserID)
|
||||
}
|
||||
}
|
||||
|
||||
@ -502,10 +502,10 @@ func ListIssues(ctx *context.APIContext) {
|
||||
SortBy: issue_indexer.SortByCreatedDesc,
|
||||
}
|
||||
if since != 0 {
|
||||
searchOpt.UpdatedAfterUnix = &since
|
||||
searchOpt.UpdatedAfterUnix = optional.Some(since)
|
||||
}
|
||||
if before != 0 {
|
||||
searchOpt.UpdatedBeforeUnix = &before
|
||||
searchOpt.UpdatedBeforeUnix = optional.Some(before)
|
||||
}
|
||||
if len(labelIDs) == 1 && labelIDs[0] == 0 {
|
||||
searchOpt.NoLabelOnly = true
|
||||
@ -526,13 +526,13 @@ func ListIssues(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
if createdByID > 0 {
|
||||
searchOpt.PosterID = &createdByID
|
||||
searchOpt.PosterID = optional.Some(createdByID)
|
||||
}
|
||||
if assignedByID > 0 {
|
||||
searchOpt.AssigneeID = &assignedByID
|
||||
searchOpt.AssigneeID = optional.Some(assignedByID)
|
||||
}
|
||||
if mentionedByID > 0 {
|
||||
searchOpt.MentionID = &mentionedByID
|
||||
searchOpt.MentionID = optional.Some(mentionedByID)
|
||||
}
|
||||
|
||||
ids, total, err := issue_indexer.SearchIssues(ctx, searchOpt)
|
||||
|
Reference in New Issue
Block a user