aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2023-04-04 05:39:47 +0200
committerGitHub <noreply@github.com>2023-04-04 04:39:47 +0100
commit2c585d62a4ebbb52175b8fd8697458ae1c3b2937 (patch)
tree6e407fcca9ebcd4cd973bfe4617d5f015df3edf5
parent17f23182ffdada3dee6a01ab2b49547e680bb02c (diff)
downloadgitea-2c585d62a4ebbb52175b8fd8697458ae1c3b2937.tar.gz
gitea-2c585d62a4ebbb52175b8fd8697458ae1c3b2937.zip
User/Org Feed render description as per web (#23887)
User descriptions should be rendered so that links and other markup appear correct in RSS feeds.
-rw-r--r--build.go1
-rw-r--r--routers/web/feed/profile.go16
2 files changed, 15 insertions, 2 deletions
diff --git a/build.go b/build.go
index d2e724a7f7..234579b514 100644
--- a/build.go
+++ b/build.go
@@ -1,7 +1,6 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
-
//go:build vendor
package main
diff --git a/routers/web/feed/profile.go b/routers/web/feed/profile.go
index b9dda2fc10..ce86727e24 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(),
}