@@ -12,6 +12,7 @@ import (
1212
1313 activities_model "code.gitea.io/gitea/models/activities"
1414 "code.gitea.io/gitea/models/db"
15+ "code.gitea.io/gitea/models/organization"
1516 "code.gitea.io/gitea/models/renderhelper"
1617 repo_model "code.gitea.io/gitea/models/repo"
1718 user_model "code.gitea.io/gitea/models/user"
@@ -256,6 +257,21 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
256257 ctx .Data ["ProfileReadme" ] = profileContent
257258 }
258259 }
260+ case "organizations" :
261+ orgs , count , err := db .FindAndCount [organization.Organization ](ctx , organization.FindOrgOptions {
262+ UserID : ctx .ContextUser .ID ,
263+ IncludePrivate : showPrivate ,
264+ ListOptions : db.ListOptions {
265+ Page : page ,
266+ PageSize : pagingNum ,
267+ },
268+ })
269+ if err != nil {
270+ ctx .ServerError ("GetUserOrganizations" , err )
271+ return
272+ }
273+ ctx .Data ["Cards" ] = orgs
274+ total = int (count )
259275 default : // default to "repositories"
260276 repos , count , err = repo_model .SearchRepository (ctx , & repo_model.SearchRepoOptions {
261277 ListOptions : db.ListOptions {
@@ -294,31 +310,7 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
294310 }
295311
296312 pager := context .NewPagination (total , pagingNum , page , 5 )
297- pager .SetDefaultParams (ctx )
298- pager .AddParamString ("tab" , tab )
299- if tab != "followers" && tab != "following" && tab != "activity" && tab != "projects" {
300- pager .AddParamString ("language" , language )
301- }
302- if tab == "activity" {
303- if ctx .Data ["Date" ] != nil {
304- pager .AddParamString ("date" , fmt .Sprint (ctx .Data ["Date" ]))
305- }
306- }
307- if archived .Has () {
308- pager .AddParamString ("archived" , fmt .Sprint (archived .Value ()))
309- }
310- if fork .Has () {
311- pager .AddParamString ("fork" , fmt .Sprint (fork .Value ()))
312- }
313- if mirror .Has () {
314- pager .AddParamString ("mirror" , fmt .Sprint (mirror .Value ()))
315- }
316- if template .Has () {
317- pager .AddParamString ("template" , fmt .Sprint (template .Value ()))
318- }
319- if private .Has () {
320- pager .AddParamString ("private" , fmt .Sprint (private .Value ()))
321- }
313+ pager .AddParamFromRequest (ctx .Req )
322314 ctx .Data ["Page" ] = pager
323315}
324316
0 commit comments