Skip to content

Commit 5ca65d3

Browse files
authored
Fix missing code in the user profile (#29865)
fix #29820 deleted by https://github.com/go-gitea/gitea/pull/29248/files#diff-2b0b591787f16325539485e648a09ab6d3177f47dc129cfe84a35ffe141dfd19L39-L62, which causing malfunction of follow/unfollow and missing description in the user profile page.
1 parent abb330e commit 5ca65d3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

routers/web/shared/user/header.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
"code.gitea.io/gitea/modules/git"
1717
"code.gitea.io/gitea/modules/gitrepo"
1818
"code.gitea.io/gitea/modules/log"
19+
"code.gitea.io/gitea/modules/markup"
20+
"code.gitea.io/gitea/modules/markup/markdown"
1921
"code.gitea.io/gitea/modules/optional"
2022
"code.gitea.io/gitea/modules/setting"
2123
"code.gitea.io/gitea/services/context"
@@ -34,6 +36,7 @@ func prepareContextForCommonProfile(ctx *context.Context) {
3436
func PrepareContextForProfileBigAvatar(ctx *context.Context) {
3537
prepareContextForCommonProfile(ctx)
3638

39+
ctx.Data["IsFollowing"] = ctx.Doer != nil && user_model.IsFollowing(ctx, ctx.Doer.ID, ctx.ContextUser.ID)
3740
ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmail && ctx.ContextUser.Email != "" && ctx.IsSigned && !ctx.ContextUser.KeepEmailPrivate
3841
if setting.Service.UserLocationMapURL != "" {
3942
ctx.Data["ContextUserLocationMapURL"] = setting.Service.UserLocationMapURL + url.QueryEscape(ctx.ContextUser.Location)
@@ -45,6 +48,17 @@ func PrepareContextForProfileBigAvatar(ctx *context.Context) {
4548
return
4649
}
4750
ctx.Data["OpenIDs"] = openIDs
51+
if len(ctx.ContextUser.Description) != 0 {
52+
content, err := markdown.RenderString(&markup.RenderContext{
53+
Metas: map[string]string{"mode": "document"},
54+
Ctx: ctx,
55+
}, ctx.ContextUser.Description)
56+
if err != nil {
57+
ctx.ServerError("RenderString", err)
58+
return
59+
}
60+
ctx.Data["RenderedDescription"] = content
61+
}
4862

4963
showPrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID)
5064
orgs, err := db.Find[organization.Organization](ctx, organization.FindOrgOptions{

0 commit comments

Comments
 (0)