aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2019-12-21 07:22:21 +0000
committerr <r@freesoftwareextremist.com>2019-12-21 07:22:21 +0000
commitdf875381d4e2c9a0bd283acc3592cde6562f5e5e (patch)
tree46f9272daad042a1e7ad6a02cdc68e4108d2a35a
parent2648484a1de4443fdb748edb144c90c4a7a37472 (diff)
downloadbloat-df875381d4e2c9a0bd283acc3592cde6562f5e5e.tar.gz
bloat-df875381d4e2c9a0bd283acc3592cde6562f5e5e.zip
Show content warning in status
-rw-r--r--renderer/renderer.go5
-rw-r--r--templates/status.tmpl2
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 + "<br />" + content
+ }
var replacements []string
for _, e := range emojis {
replacements = append(replacements, ":"+e.ShortCode+":", "<img class=\"status-emoji\" src=\""+e.URL+"\" alt=\""+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}}
</div>
- <div class="status-content"> {{StatusContentFilter .Content .Emojis .Mentions}} </div>
+ <div class="status-content"> {{StatusContentFilter .SpoilerText .Content .Emojis .Mentions}} </div>
<div class="status-media-container">
{{range .MediaAttachments}}
{{if eq .Type "image"}}