@ -90,35 +90,7 @@ func Profile(ctx *context.Context) {
tab := ctx . Query ( "tab" )
ctx . Data [ "TabName" ] = tab
switch tab {
case "activity" :
retrieveFeeds ( ctx , ctxUser , - 1 , 0 , ! showPrivate )
if ctx . Written ( ) {
return
}
case "stars" :
page := ctx . QueryInt ( "page" )
if page <= 0 {
page = 1
}
repos , err := ctxUser . GetStarredRepos ( showPrivate , page , setting . UI . User . RepoPagingNum , "" )
if err != nil {
ctx . Handle ( 500 , "GetStarredRepos" , err )
return
}
counts , err := ctxUser . GetStarredRepoCount ( showPrivate )
if err != nil {
ctx . Handle ( 500 , "GetStarredRepoCount" , err )
return
}
ctx . Data [ "Repos" ] = repos
ctx . Data [ "Page" ] = paginater . New ( int ( counts ) , setting . UI . User . RepoPagingNum , page , 5 )
ctx . Data [ "Total" ] = int ( counts )
ctx . Data [ "Tabs" ] = "stars"
default :
page := ctx . QueryInt ( "page" )
if page <= 0 {
page = 1
@ -127,7 +99,6 @@ func Profile(ctx *context.Context) {
var (
repos [ ] * models . Repository
count int64
err error
orderBy string
)
@ -157,6 +128,46 @@ func Profile(ctx *context.Context) {
keyword := strings . Trim ( ctx . Query ( "q" ) , " " )
ctx . Data [ "Keyword" ] = keyword
switch tab {
case "activity" :
retrieveFeeds ( ctx , ctxUser , - 1 , 0 , ! showPrivate )
if ctx . Written ( ) {
return
}
case "stars" :
ctx . Data [ "PageIsProfileStarList" ] = true
if len ( keyword ) == 0 {
repos , err = ctxUser . GetStarredRepos ( showPrivate , page , setting . UI . User . RepoPagingNum , orderBy )
if err != nil {
ctx . Handle ( 500 , "GetStarredRepos" , err )
return
}
count , err = ctxUser . GetStarredRepoCount ( showPrivate )
if err != nil {
ctx . Handle ( 500 , "GetStarredRepoCount" , err )
return
}
} else {
repos , count , err = models . SearchRepositoryByName ( & models . SearchRepoOptions {
Keyword : keyword ,
OwnerID : ctxUser . ID ,
OrderBy : orderBy ,
Private : showPrivate ,
Page : page ,
PageSize : setting . UI . User . RepoPagingNum ,
Starred : true ,
} )
if err != nil {
ctx . Handle ( 500 , "SearchRepositoryByName" , err )
return
}
}
ctx . Data [ "Repos" ] = repos
ctx . Data [ "Page" ] = paginater . New ( int ( count ) , setting . UI . User . RepoPagingNum , page , 5 )
ctx . Data [ "Total" ] = count
default :
if len ( keyword ) == 0 {
var total int
repos , err = models . GetUserRepositories ( ctxUser . ID , showPrivate , page , setting . UI . User . RepoPagingNum , orderBy )