1
1
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


![image](https://github.com/user-attachments/assets/296c5109-8fc1-43ea-b7dc-e79919cc1f9a)

![image](https://github.com/user-attachments/assets/d30980f6-22e4-4b97-9143-c750dc399da6)


------
⚠️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:
yp05327
2024-12-27 03:49:50 +09:00
committed by GitHub
parent 550abdbc24
commit 7bb7ba1b5b
7 changed files with 38 additions and 25 deletions

View File

@@ -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)