From df875381d4e2c9a0bd283acc3592cde6562f5e5e Mon Sep 17 00:00:00 2001 From: r Date: Sat, 21 Dec 2019 07:22:21 +0000 Subject: Show content warning in status --- renderer/renderer.go | 5 ++++- templates/status.tmpl | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/renderer/renderer.go b/renderer/renderer.go index c9cae28..cabf92d 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -84,7 +84,10 @@ func EmojiFilter(content string, emojis []mastodon.Emoji) string { return strings.NewReplacer(replacements...).Replace(content) } -func StatusContentFilter(content string, emojis []mastodon.Emoji, mentions []mastodon.Mention) string { +func StatusContentFilter(spoiler string, content string, emojis []mastodon.Emoji, mentions []mastodon.Mention) string { + if len(spoiler) > 0 { + content = spoiler + "
" + content + } var replacements []string for _, e := range emojis { replacements = append(replacements, ":"+e.ShortCode+":", "\""+e.ShortCode+"\"") diff --git a/templates/status.tmpl b/templates/status.tmpl index b1babf6..0e6f0c0 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -41,7 +41,7 @@ {{end}} {{end}} -
{{StatusContentFilter .Content .Emojis .Mentions}}
+
{{StatusContentFilter .SpoilerText .Content .Emojis .Mentions}}
{{range .MediaAttachments}} {{if eq .Type "image"}} -- cgit v1.2.3