Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Dec 22, 2024
1 parent 35c86af commit 4d227f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions routers/web/org/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions templates/org/menu.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
{{end}}
</a>
{{end}}
{{if .HasProfileWiki}}
<a class="item" href="{{$.OrgProfileRepo.Link}}/wiki">
{{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}}
</a>
{{end}}
{{if and .IsPackageEnabled .CanReadPackages}}
<a class="{{if .IsPackagesPage}}active {{end}}item" href="{{$.Org.HomeLink}}/-/packages">
{{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}
Expand Down

0 comments on commit 4d227f3

Please sign in to comment.