mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-16 23:01:00 +01:00
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.
This commit is contained in:
parent
17f23182ff
commit
2c585d62a4
2 changed files with 15 additions and 2 deletions
1
build.go
1
build.go
|
@ -1,7 +1,6 @@
|
|||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
|
||||
//go:build vendor
|
||||
|
||||
package main
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue