Skip to content

Commit 1a17ca7

Browse files
committed
fix Description
1 parent 2854ddf commit 1a17ca7

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

routers/web/org/home.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"code.gitea.io/gitea/modules/markup/markdown"
2121
"code.gitea.io/gitea/modules/setting"
2222
"code.gitea.io/gitea/modules/util"
23+
"code.gitea.io/gitea/routers/web/shared/user"
2324
shared_user "code.gitea.io/gitea/routers/web/shared/user"
2425
)
2526

@@ -41,22 +42,11 @@ func Home(ctx *context.Context) {
4142
if ctx.Written() {
4243
return
4344
}
44-
45+
user.PrepareContextForOrgProfileBigAvatar(ctx)
4546
org := ctx.Org.Organization
4647

4748
ctx.Data["PageIsUserProfile"] = true
4849
ctx.Data["Title"] = org.DisplayName()
49-
if len(org.Description) != 0 {
50-
desc, err := markdown.RenderString(&markup.RenderContext{
51-
Ctx: ctx,
52-
Metas: map[string]string{"mode": "document"},
53-
}, org.Description)
54-
if err != nil {
55-
ctx.ServerError("RenderString", err)
56-
return
57-
}
58-
ctx.Data["RenderedDescription"] = desc
59-
}
6050

6151
var orderBy db.SearchOrderBy
6252
ctx.Data["SortType"] = ctx.FormString("sort")

routers/web/shared/user/header.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ func PrepareContextForOrgProfileBigAvatar(ctx *context.Context) {
3535
prepareContextForCommonProfile(ctx)
3636

3737
ctx.Data["IsFollowing"] = ctx.Doer != nil && user_model.IsFollowing(ctx, ctx.Doer.ID, ctx.ContextUser.ID)
38+
39+
if len(ctx.ContextUser.Description) != 0 {
40+
desc, err := markdown.RenderString(&markup.RenderContext{
41+
Ctx: ctx,
42+
Metas: map[string]string{"mode": "document"},
43+
}, ctx.ContextUser.Description)
44+
if err != nil {
45+
ctx.ServerError("RenderString", err)
46+
return
47+
}
48+
ctx.Data["RenderedDescription"] = desc
49+
}
3850
}
3951

4052
// PrepareContextForProfileBigAvatar set the context for big avatar view on the profile page

0 commit comments

Comments
 (0)