aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates/helper.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-02-25 06:34:51 +0800
committerGitHub <noreply@github.com>2024-02-24 22:34:51 +0000
commit10c7996b5a5c705964fc6cc9c1817eea1fc436ef (patch)
treeaa05e188128ff0d985c0302d5b5a133e46046e8f /modules/templates/helper.go
parentff9dc512438f1a3bc36cc8c419d8450f808517f9 (diff)
downloadgitea-10c7996b5a5c705964fc6cc9c1817eea1fc436ef.tar.gz
gitea-10c7996b5a5c705964fc6cc9c1817eea1fc436ef.zip
Remove RenderEmojiPlain from template helper (#29375)
RenderEmojiPlain(emoji.ReplaceAliases) should be called explicitly for some contents, but not for everything. Actually in modern days, in most cases it doesn't need such "ReplaceAliases". So only keep it for issue/PR titles. If anyone really needs to do ReplaceAliases for some contents, I will propose a following fix.
Diffstat (limited to 'modules/templates/helper.go')
-rw-r--r--modules/templates/helper.go12
1 files changed, 0 insertions, 12 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 6e42594b0b..691f754748 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -14,7 +14,6 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
- "code.gitea.io/gitea/modules/emoji"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/svg"
@@ -159,7 +158,6 @@ func NewFuncMap() template.FuncMap {
"RenderCodeBlock": RenderCodeBlock,
"RenderIssueTitle": RenderIssueTitle,
"RenderEmoji": RenderEmoji,
- "RenderEmojiPlain": RenderEmojiPlain,
"ReactionToEmoji": ReactionToEmoji,
"RenderMarkdownToHtml": RenderMarkdownToHtml,
@@ -215,16 +213,6 @@ func JSEscapeSafe(s string) template.HTML {
return template.HTML(template.JSEscapeString(s))
}
-func RenderEmojiPlain(s any) any {
- switch v := s.(type) {
- case string:
- return emoji.ReplaceAliases(v)
- case template.HTML:
- return template.HTML(emoji.ReplaceAliases(string(v)))
- }
- panic(fmt.Sprintf("unexpected type %T", s))
-}
-
// DotEscape wraps a dots in names with ZWJ [U+200D] in order to prevent autolinkers from detecting these as urls
func DotEscape(raw string) string {
return strings.ReplaceAll(raw, ".", "\u200d.\u200d")