Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
yp05327 committed Aug 8, 2023
1 parent 5effed4 commit 3ade541
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 3 additions & 2 deletions modules/context/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Organization struct {
Organization *organization.Organization
OrgLink string
CanCreateOrgRepo bool
PublicMemberOnly bool // Only display public members

Team *organization.Team
Teams []*organization.Team
Expand Down Expand Up @@ -173,11 +174,11 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
ctx.Data["OrgLink"] = ctx.Org.OrgLink

// Member
ctx.Org.PublicMemberOnly = ctx.Doer == nil || !ctx.Org.IsMember && !ctx.Doer.IsAdmin
opts := &organization.FindOrgMembersOpts{
OrgID: org.ID,
PublicOnly: true,
PublicOnly: ctx.Org.PublicMemberOnly,
}
opts.PublicOnly = ctx.Doer == nil || !ctx.Org.IsMember && !ctx.Doer.IsAdmin
ctx.Data["NumMembers"], err = organization.CountOrgMembers(opts)
if err != nil {
ctx.ServerError("CountOrgMembers", err)
Expand Down
7 changes: 1 addition & 6 deletions routers/web/org/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,9 @@ func Home(ctx *context.Context) {

opts := &organization.FindOrgMembersOpts{
OrgID: org.ID,
PublicOnly: true,
PublicOnly: ctx.Org.PublicMemberOnly,
ListOptions: db.ListOptions{Page: 1, PageSize: 25},
}

if ctx.Doer != nil {
opts.PublicOnly = !ctx.Org.IsMember && !ctx.Doer.IsAdmin
}

members, _, err := organization.FindOrgMembers(opts)
if err != nil {
ctx.ServerError("FindOrgMembers", err)
Expand Down

0 comments on commit 3ade541

Please sign in to comment.