@@ -130,6 +130,8 @@ func Profile(ctx *context.Context) {
130
130
err error
131
131
orderBy string
132
132
)
133
+
134
+ ctx .Data ["SortType" ] = ctx .Query ("sort" )
133
135
switch ctx .Query ("sort" ) {
134
136
case "newest" :
135
137
orderBy = "created_unix DESC"
@@ -144,10 +146,17 @@ func Profile(ctx *context.Context) {
144
146
case "alphabetically" :
145
147
orderBy = "name ASC"
146
148
default :
149
+ ctx .Data ["SortType" ] = "recentupdate"
147
150
orderBy = "updated_unix DESC"
148
151
}
149
152
153
+ // set default sort value if sort is empty.
154
+ if ctx .Query ("sort" ) == "" {
155
+ ctx .Data ["SortType" ] = "recentupdate"
156
+ }
157
+
150
158
keyword := ctx .Query ("q" )
159
+ ctx .Data ["Keyword" ] = keyword
151
160
if len (keyword ) == 0 {
152
161
var total int
153
162
repos , err = models .GetUserRepositories (ctxUser .ID , showPrivate , page , setting .UI .User .RepoPagingNum , orderBy )
@@ -175,7 +184,7 @@ func Profile(ctx *context.Context) {
175
184
Keyword : keyword ,
176
185
OwnerID : ctxUser .ID ,
177
186
OrderBy : orderBy ,
178
- Private : ctx . IsSigned && ctx . User . ID == ctxUser . ID ,
187
+ Private : showPrivate ,
179
188
Page : page ,
180
189
PageSize : setting .UI .User .RepoPagingNum ,
181
190
})
@@ -188,15 +197,6 @@ func Profile(ctx *context.Context) {
188
197
ctx .Data ["Page" ] = paginater .New (int (count ), setting .UI .User .RepoPagingNum , page , 5 )
189
198
ctx .Data ["Total" ] = count
190
199
}
191
-
192
- // set default sort value.
193
- if ctx .Query ("sort" ) == "" {
194
- ctx .Data ["SortType" ] = "recentupdate"
195
- } else {
196
- ctx .Data ["SortType" ] = ctx .Query ("sort" )
197
- }
198
-
199
- ctx .Data ["Keyword" ] = keyword
200
200
}
201
201
202
202
ctx .HTML (200 , tplProfile )
0 commit comments