mirror of
https://github.com/go-gitea/gitea
synced 2025-07-16 07:18:37 +00:00
Add show more
organizations icon in user's profile (#32986)
Close #32952 # ⚠️ Doc update is required   ------ ⚠️This PR refuses to be cherry-picked by any forked projects without any mentions. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -61,11 +61,20 @@ func PrepareContextForProfileBigAvatar(ctx *context.Context) {
|
||||
orgs, err := db.Find[organization.Organization](ctx, organization.FindOrgOptions{
|
||||
UserID: ctx.ContextUser.ID,
|
||||
IncludePrivate: showPrivate,
|
||||
ListOptions: db.ListOptions{
|
||||
Page: 1,
|
||||
// query one more results (without a separate counting) to see whether we need to add the "show more orgs" link
|
||||
PageSize: setting.UI.User.OrgPagingNum + 1,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("FindOrgs", err)
|
||||
return
|
||||
}
|
||||
if len(orgs) > setting.UI.User.OrgPagingNum {
|
||||
orgs = orgs[:setting.UI.User.OrgPagingNum]
|
||||
ctx.Data["ShowMoreOrgs"] = true
|
||||
}
|
||||
ctx.Data["Orgs"] = orgs
|
||||
ctx.Data["HasOrgsVisible"] = organization.HasOrgsVisible(ctx, orgs, ctx.Doer)
|
||||
|
||||
|
Reference in New Issue
Block a user