1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Calculate PublicOnly for org membership only once (#32234)

Refactoring of #32211

this move the PublicOnly() filter calcuation next to the DB querys and
let it be decided by the Doer


---
*Sponsored by Kithara Software GmbH*
This commit is contained in:
6543
2024-11-11 01:38:30 +01:00
committed by GitHub
parent b1f42a0cdd
commit 43c252dfea
7 changed files with 73 additions and 54 deletions

View File

@@ -34,8 +34,8 @@ func Members(ctx *context.Context) {
}
opts := &organization.FindOrgMembersOpts{
OrgID: org.ID,
PublicOnly: true,
Doer: ctx.Doer,
OrgID: org.ID,
}
if ctx.Doer != nil {
@@ -44,9 +44,9 @@ func Members(ctx *context.Context) {
ctx.Error(http.StatusInternalServerError, "IsOrgMember")
return
}
opts.PublicOnly = !isMember && !ctx.Doer.IsAdmin
opts.IsDoerMember = isMember
}
ctx.Data["PublicOnly"] = opts.PublicOnly
ctx.Data["PublicOnly"] = opts.PublicOnly()
total, err := organization.CountOrgMembers(ctx, opts)
if err != nil {