summaryrefslogtreecommitdiffstats
path: root/routers/user/profile.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-08-05 09:48:37 +0200
committerGitHub <noreply@github.com>2020-08-05 15:48:37 +0800
commit2872a04f2796b369fb388c6f34780bbda2e64710 (patch)
tree958a4814c21b3cee8ff2ee1ce9a8f8d01ad85bec /routers/user/profile.go
parent6ab4d76ced00415bff636865e6b14c547bd357c8 (diff)
downloadgitea-2872a04f2796b369fb388c6f34780bbda2e64710.tar.gz
gitea-2872a04f2796b369fb388c6f34780bbda2e64710.zip
UserProfile Page: Render Description (#12415)
* If Description contain more that one line render it * simpler ... * only render if description exists * Fix NPE in tests * Update routers/user/profile.go Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'routers/user/profile.go')
-rw-r--r--routers/user/profile.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/user/profile.go b/routers/user/profile.go
index 82fab4ad87..653d3cea22 100644
--- a/routers/user/profile.go
+++ b/routers/user/profile.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/routers/org"
@@ -97,6 +98,10 @@ func Profile(ctx *context.Context) {
// so everyone would get the same empty heatmap
ctx.Data["EnableHeatmap"] = setting.Service.EnableUserHeatmap && !ctxUser.KeepActivityPrivate
ctx.Data["HeatmapUser"] = ctxUser.Name
+ if len(ctxUser.Description) != 0 {
+ ctx.Data["RenderedDescription"] = string(markdown.Render([]byte(ctxUser.Description), ctx.Repo.RepoLink, map[string]string{"mode": "document"}))
+ }
+
showPrivate := ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID)
orgs, err := models.GetOrgsByUserID(ctxUser.ID, showPrivate)