diff options
author | Giteabot <teabot@gitea.io> | 2023-04-04 00:44:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-04 00:44:50 -0400 |
commit | dff3ce089d9e1ab685b5ae42980903566972cba3 (patch) | |
tree | 67f180d2deb3970a927a0396bc44347d318db0f6 /routers | |
parent | 9836b7db7baf896c3d141270ce8ba52944ab146c (diff) | |
download | gitea-dff3ce089d9e1ab685b5ae42980903566972cba3.tar.gz gitea-dff3ce089d9e1ab685b5ae42980903566972cba3.zip |
User/Org Feed render description as per web (#23887) (#23906)
Backport #23887 by @6543
User descriptions should be rendered so that links and other markup
appear correct in RSS feeds.
test will be added by #23874
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/feed/profile.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/routers/web/feed/profile.go b/routers/web/feed/profile.go index 7641769192..d3b0c175d5 100644 --- a/routers/web/feed/profile.go +++ b/routers/web/feed/profile.go @@ -8,6 +8,8 @@ import ( activities_model "code.gitea.io/gitea/models/activities" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/markup" + "code.gitea.io/gitea/modules/markup/markdown" "github.com/gorilla/feeds" ) @@ -39,10 +41,22 @@ func showUserFeed(ctx *context.Context, formatType string) { return } + ctxUserDescription, err := markdown.RenderString(&markup.RenderContext{ + Ctx: ctx, + URLPrefix: ctx.ContextUser.HTMLURL(), + Metas: map[string]string{ + "user": ctx.ContextUser.GetDisplayName(), + }, + }, ctx.ContextUser.Description) + if err != nil { + ctx.ServerError("RenderString", err) + return + } + feed := &feeds.Feed{ Title: ctx.Tr("home.feed_of", ctx.ContextUser.DisplayName()), Link: &feeds.Link{Href: ctx.ContextUser.HTMLURL()}, - Description: ctx.ContextUser.Description, + Description: ctxUserDescription, Created: time.Now(), } |