@@ -23,7 +23,6 @@ import (
2323 "code.gitea.io/gitea/models/unit"
2424 user_model "code.gitea.io/gitea/models/user"
2525 "code.gitea.io/gitea/modules/base"
26- conversation_indexer "code.gitea.io/gitea/modules/indexer/conversations"
2726 "code.gitea.io/gitea/modules/log"
2827 "code.gitea.io/gitea/modules/markup"
2928 "code.gitea.io/gitea/modules/markup/markdown"
@@ -411,67 +410,6 @@ func GetConversationInfo(ctx *context.Context) {
411410 })
412411}
413412
414- // SearchConversations searches for conversations across the repositories that the user has access to
415- func SearchConversations (ctx * context.Context ) {
416- before , since , err := context .GetQueryBeforeSince (ctx .Base )
417- if err != nil {
418- ctx .Error (http .StatusUnprocessableEntity , err .Error ())
419- return
420- }
421-
422- repoIDs , allPublic := GetUserAccessibleRepo (ctx )
423-
424- keyword := ctx .FormTrim ("q" )
425- if strings .IndexByte (keyword , 0 ) >= 0 {
426- keyword = ""
427- }
428-
429- // this api is also used in UI,
430- // so the default limit is set to fit UI needs
431- limit := ctx .FormInt ("limit" )
432- if limit == 0 {
433- limit = setting .UI .ConversationPagingNum
434- } else if limit > setting .API .MaxResponseItems {
435- limit = setting .API .MaxResponseItems
436- }
437-
438- searchOpt := & conversation_indexer.SearchOptions {
439- Paginator : & db.ListOptions {
440- Page : ctx .FormInt ("page" ),
441- PageSize : limit ,
442- },
443- Keyword : keyword ,
444- RepoIDs : repoIDs ,
445- AllPublic : allPublic ,
446- SortBy : conversation_indexer .SortByCreatedDesc ,
447- }
448-
449- if since != 0 {
450- searchOpt .UpdatedAfterUnix = optional .Some (since )
451- }
452- if before != 0 {
453- searchOpt .UpdatedBeforeUnix = optional .Some (before )
454- }
455-
456- // FIXME: It's unsupported to sort by priority repo when searching by indexer,
457- // it's indeed an regression, but I think it is worth to support filtering by indexer first.
458- _ = ctx .FormInt64 ("priority_repo_id" )
459-
460- ids , total , err := conversation_indexer .SearchConversations (ctx , searchOpt )
461- if err != nil {
462- ctx .Error (http .StatusInternalServerError , "SearchConversations" , err .Error ())
463- return
464- }
465- conversations , err := conversations_model .GetConversationsByIDs (ctx , ids , true )
466- if err != nil {
467- ctx .Error (http .StatusInternalServerError , "FindConversationsByIDs" , err .Error ())
468- return
469- }
470-
471- ctx .SetTotalCountHeader (total )
472- ctx .JSON (http .StatusOK , convert .ToConversationList (ctx , ctx .Doer , conversations ))
473- }
474-
475413func GetUserAccessibleRepo (ctx * context.Context ) ([]int64 , bool ) {
476414 var (
477415 repoIDs []int64
@@ -540,50 +478,6 @@ func GetUserAccessibleRepo(ctx *context.Context) ([]int64, bool) {
540478 return repoIDs , allPublic
541479}
542480
543- // ListConversations list the conversations of a repository
544- func ListConversations (ctx * context.Context ) {
545- before , since , err := context .GetQueryBeforeSince (ctx .Base )
546- if err != nil {
547- ctx .Error (http .StatusUnprocessableEntity , err .Error ())
548- return
549- }
550-
551- keyword := ctx .FormTrim ("q" )
552- if strings .IndexByte (keyword , 0 ) >= 0 {
553- keyword = ""
554- }
555-
556- searchOpt := & conversation_indexer.SearchOptions {
557- Paginator : & db.ListOptions {
558- Page : ctx .FormInt ("page" ),
559- PageSize : convert .ToCorrectPageSize (ctx .FormInt ("limit" )),
560- },
561- Keyword : keyword ,
562- RepoIDs : []int64 {ctx .Repo .Repository .ID },
563- SortBy : conversation_indexer .SortByCreatedDesc ,
564- }
565- if since != 0 {
566- searchOpt .UpdatedAfterUnix = optional .Some (since )
567- }
568- if before != 0 {
569- searchOpt .UpdatedBeforeUnix = optional .Some (before )
570- }
571-
572- ids , total , err := conversation_indexer .SearchConversations (ctx , searchOpt )
573- if err != nil {
574- ctx .Error (http .StatusInternalServerError , "SearchConversations" , err .Error ())
575- return
576- }
577- conversations , err := conversations_model .GetConversationsByIDs (ctx , ids , true )
578- if err != nil {
579- ctx .Error (http .StatusInternalServerError , "FindConversationsByIDs" , err .Error ())
580- return
581- }
582-
583- ctx .SetTotalCountHeader (total )
584- ctx .JSON (http .StatusOK , convert .ToConversationList (ctx , ctx .Doer , conversations ))
585- }
586-
587481func BatchDeleteConversations (ctx * context.Context ) {
588482 conversations := getActionConversations (ctx )
589483 if ctx .Written () {
0 commit comments