aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-08-15 23:00:35 +0900
committerGitHub <noreply@github.com>2023-08-15 16:00:35 +0200
commit7f8028e5a1ee5e99ef491bf037a7171998322bd2 (patch)
tree19e1918400fa051b60c6ebbe3cca8357d5d92485 /routers
parent27e4ac3e40265722abf9f99d519cb5985eebd1c7 (diff)
downloadgitea-7f8028e5a1ee5e99ef491bf037a7171998322bd2.tar.gz
gitea-7f8028e5a1ee5e99ef491bf037a7171998322bd2.zip
Fix display problems of members and teams unit (#26363)
Fix: - display member count and team count in the menu bar ![image](https://github.com/go-gitea/gitea/assets/18380374/7f03ced4-67e2-41ce-b19f-a992823726bb) - Also display member unit in the menu bar if there are no hidden members in public org ![image](https://github.com/go-gitea/gitea/assets/18380374/31422ad6-7190-438d-8e99-8a4af9cce908) - hidden member board when there's no seeable members. In this org, we only have hidden members: ![image](https://github.com/go-gitea/gitea/assets/18380374/d749420b-554a-4483-8cd2-221df61b5ca7) We will hidden the member board when doer is not the member of this org ![image](https://github.com/go-gitea/gitea/assets/18380374/93bb782e-7d4d-4ad3-a096-133afbc51f8a) Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/eafc0b3e-6218-42ab-a892-39645d08a5eb) If you click the number in the members board, you will access the members page, which is not expected. ![image](https://github.com/go-gitea/gitea/assets/18380374/73d6dadc-0ef2-4ca9-8485-c5f4211bffb2) --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'routers')
-rw-r--r--routers/web/org/home.go21
1 files changed, 3 insertions, 18 deletions
diff --git a/routers/web/org/home.go b/routers/web/org/home.go
index 9104c15f94..613dff2182 100644
--- a/routers/web/org/home.go
+++ b/routers/web/org/home.go
@@ -120,31 +120,15 @@ 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 {
- isMember, err := org.IsOrgMember(ctx.Doer.ID)
- if err != nil {
- ctx.Error(http.StatusInternalServerError, "IsOrgMember")
- return
- }
- opts.PublicOnly = !isMember && !ctx.Doer.IsAdmin
- }
-
members, _, err := organization.FindOrgMembers(opts)
if err != nil {
ctx.ServerError("FindOrgMembers", err)
return
}
- membersCount, err := organization.CountOrgMembers(opts)
- if err != nil {
- ctx.ServerError("CountOrgMembers", err)
- return
- }
-
var isFollowing bool
if ctx.Doer != nil {
isFollowing = user_model.IsFollowing(ctx.Doer.ID, ctx.ContextUser.ID)
@@ -152,7 +136,6 @@ func Home(ctx *context.Context) {
ctx.Data["Repos"] = repos
ctx.Data["Total"] = count
- ctx.Data["MembersTotal"] = membersCount
ctx.Data["Members"] = members
ctx.Data["Teams"] = ctx.Org.Teams
ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull
@@ -171,5 +154,7 @@ func Home(ctx *context.Context) {
ctx.Data["Page"] = pager
ctx.Data["ContextUser"] = ctx.ContextUser
+ ctx.Data["ShowMemberAndTeamTab"] = ctx.Org.IsMember || len(members) > 0
+
ctx.HTML(http.StatusOK, tplOrgHome)
}