Show content warning in status

This commit is contained in:
r 2019-12-21 07:22:21 +00:00
parent 2648484a1d
commit df875381d4
2 changed files with 5 additions and 2 deletions

View file

@ -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+"\" />")

View file

@ -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"}}