From 4d227f3caea86dec755dee2cd2d4b5be6e9758ee Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 22 Dec 2024 21:06:21 +0800 Subject: [PATCH] fix --- routers/web/org/home.go | 9 ++++++--- templates/org/menu.tmpl | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/routers/web/org/home.go b/routers/web/org/home.go index f02c08ae7691a..5b4ef4419b93e 100644 --- a/routers/web/org/home.go +++ b/routers/web/org/home.go @@ -111,7 +111,7 @@ func home(ctx *context.Context, viewRepositories bool) { ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull ctx.Data["ShowMemberAndTeamTab"] = ctx.Org.IsMember || len(members) > 0 - if !prepareOrgProfileReadme(ctx, viewRepositories) { + if !prepareOrgProfileRepo(ctx, viewRepositories) { ctx.Data["PageIsViewRepositories"] = true } @@ -168,15 +168,18 @@ func home(ctx *context.Context, viewRepositories bool) { ctx.HTML(http.StatusOK, tplOrgHome) } -func prepareOrgProfileReadme(ctx *context.Context, viewRepositories bool) bool { +func prepareOrgProfileRepo(ctx *context.Context, viewRepositories bool) bool { profileDbRepo, profileGitRepo, profileReadme, profileClose := shared_user.FindUserProfileReadme(ctx, ctx.Doer) defer profileClose() - ctx.Data["HasProfileReadme"] = profileReadme != nil if profileGitRepo == nil || profileReadme == nil || viewRepositories { return false } + ctx.Data["OrgProfileRepo"] = profileDbRepo + ctx.Data["HasProfileWiki"] = profileDbRepo.HasWiki() + ctx.Data["HasProfileReadme"] = true + if bytes, err := profileReadme.GetBlobContent(setting.UI.MaxDisplayFileSize); err != nil { log.Error("failed to GetBlobContent: %v", err) } else { diff --git a/templates/org/menu.tmpl b/templates/org/menu.tmpl index 29238f8d6bb9a..3d490f6787222 100644 --- a/templates/org/menu.tmpl +++ b/templates/org/menu.tmpl @@ -20,6 +20,11 @@ {{end}} {{end}} + {{if .HasProfileWiki}} + + {{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}} + + {{end}} {{if and .IsPackageEnabled .CanReadPackages}} {{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}