@@ -476,6 +476,9 @@ completeShareBranchHelper authHTTPClient query = do
476
476
pure $
477
477
Monoid. whenM (Text. isPrefixOf branchOrContributorPrefix " releases" ) [handle <> " /" <> proj <> " /releases/" ]
478
478
<> results
479
+ [handle, proj, " releases" , " " ] -> do
480
+ searchProjectReleases authHTTPClient handle proj " "
481
+ <&> (handle <> " /" <> proj <> " /releases/latest" : )
479
482
[handle, proj, " releases" , branch]
480
483
| Text. isPrefixOf branch " latest" -> pure [handle <> " /" <> proj <> " /releases/latest" ]
481
484
| otherwise -> do
@@ -496,14 +499,14 @@ searchProjectBranches ::
496
499
m [Text ]
497
500
searchProjectBranches (AuthenticatedHttpClient httpManager) handle proj contributor query = do
498
501
fromMaybe [] <$> runMaybeT do
499
- let searchKind = case contributor of
500
- Just {} -> " contributor"
501
- Nothing -> " core"
502
+ let ( searchKind, contributorFilter) = case contributor of
503
+ Just contributor -> ( " contributor" , " &contributor-handle= " <> contributor)
504
+ Nothing -> ( " core" , " " )
502
505
let cleanedHandle = Text. dropWhile (== ' @' ) handle
503
506
let uri =
504
507
(Share. codeserverToURI Codeserver. defaultCodeserver)
505
508
{ URI. uriPath = " /users/" <> Text. unpack cleanedHandle <> " /projects/" <> Text. unpack proj <> " /branches" ,
506
- URI. uriQuery = Text. unpack $ " ?name-prefix=" <> query <> " &kind=" <> searchKind
509
+ URI. uriQuery = Text. unpack $ " ?name-prefix=" <> query <> " &kind=" <> searchKind <> contributorFilter
507
510
}
508
511
Debug. debugM Debug. Temp " searchProjectBranches: uri: " (Text. pack $ show uri)
509
512
req <- MaybeT $ pure (HTTP. requestFromURI uri)
0 commit comments