aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/shared
diff options
context:
space:
mode:
authorNanguan Lin <nanguanlin6@gmail.com>2024-03-18 04:28:11 +0800
committerGitHub <noreply@github.com>2024-03-17 21:28:11 +0100
commit5ca65d33906ebbca1e502536ffef18942b541c1d (patch)
tree0bef5f26864f7af7a798f7d8339f38e806509bcf /routers/web/shared
parentabb330e6139c37f3c1d84b30625c1f5495a4eb49 (diff)
downloadgitea-5ca65d33906ebbca1e502536ffef18942b541c1d.tar.gz
gitea-5ca65d33906ebbca1e502536ffef18942b541c1d.zip
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.
Diffstat (limited to 'routers/web/shared')
-rw-r--r--routers/web/shared/user/header.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/routers/web/shared/user/header.go b/routers/web/shared/user/header.go
index 2d6d9ad98d..7531e1ba26 100644
--- a/routers/web/shared/user/header.go
+++ b/routers/web/shared/user/header.go
@@ -16,6 +16,8 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/gitrepo"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/markup"
+ "code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/optional"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/services/context"
@@ -34,6 +36,7 @@ func prepareContextForCommonProfile(ctx *context.Context) {
func PrepareContextForProfileBigAvatar(ctx *context.Context) {
prepareContextForCommonProfile(ctx)
+ ctx.Data["IsFollowing"] = ctx.Doer != nil && user_model.IsFollowing(ctx, ctx.Doer.ID, ctx.ContextUser.ID)
ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmail && ctx.ContextUser.Email != "" && ctx.IsSigned && !ctx.ContextUser.KeepEmailPrivate
if setting.Service.UserLocationMapURL != "" {
ctx.Data["ContextUserLocationMapURL"] = setting.Service.UserLocationMapURL + url.QueryEscape(ctx.ContextUser.Location)
@@ -45,6 +48,17 @@ func PrepareContextForProfileBigAvatar(ctx *context.Context) {
return
}
ctx.Data["OpenIDs"] = openIDs
+ if len(ctx.ContextUser.Description) != 0 {
+ content, err := markdown.RenderString(&markup.RenderContext{
+ Metas: map[string]string{"mode": "document"},
+ Ctx: ctx,
+ }, ctx.ContextUser.Description)
+ if err != nil {
+ ctx.ServerError("RenderString", err)
+ return
+ }
+ ctx.Data["RenderedDescription"] = content
+ }
showPrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID)
orgs, err := db.Find[organization.Organization](ctx, organization.FindOrgOptions{