Skip to content

Commit 2c585d6

Browse files
authoredApr 4, 2023
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.
1 parent 17f2318 commit 2c585d6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
 

‎build.go

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2020 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33

4-
54
//go:build vendor
65

76
package main

‎routers/web/feed/profile.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88

99
activities_model "code.gitea.io/gitea/models/activities"
1010
"code.gitea.io/gitea/modules/context"
11+
"code.gitea.io/gitea/modules/markup"
12+
"code.gitea.io/gitea/modules/markup/markdown"
1113

1214
"github.com/gorilla/feeds"
1315
)
@@ -39,10 +41,22 @@ func showUserFeed(ctx *context.Context, formatType string) {
3941
return
4042
}
4143

44+
ctxUserDescription, err := markdown.RenderString(&markup.RenderContext{
45+
Ctx: ctx,
46+
URLPrefix: ctx.ContextUser.HTMLURL(),
47+
Metas: map[string]string{
48+
"user": ctx.ContextUser.GetDisplayName(),
49+
},
50+
}, ctx.ContextUser.Description)
51+
if err != nil {
52+
ctx.ServerError("RenderString", err)
53+
return
54+
}
55+
4256
feed := &feeds.Feed{
4357
Title: ctx.Tr("home.feed_of", ctx.ContextUser.DisplayName()),
4458
Link: &feeds.Link{Href: ctx.ContextUser.HTMLURL()},
45-
Description: ctx.ContextUser.Description,
59+
Description: ctxUserDescription,
4660
Created: time.Now(),
4761
}
4862

0 commit comments

Comments
 (0)
Please sign in to comment.