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) 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 var replacements []string
for _, e := range emojis { for _, e := range emojis {
replacements = append(replacements, ":"+e.ShortCode+":", "<img class=\"status-emoji\" src=\""+e.URL+"\" alt=\""+e.ShortCode+"\" />") replacements = append(replacements, ":"+e.ShortCode+":", "<img class=\"status-emoji\" src=\""+e.URL+"\" alt=\""+e.ShortCode+"\" />")

View File

@ -41,7 +41,7 @@
{{end}} {{end}}
{{end}} {{end}}
</div> </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"> <div class="status-media-container">
{{range .MediaAttachments}} {{range .MediaAttachments}}
{{if eq .Type "image"}} {{if eq .Type "image"}}