Show content warning in status
This commit is contained in:
parent
2648484a1d
commit
df875381d4
|
@ -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+"\" />")
|
||||||
|
|
|
@ -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"}}
|
||||||
|
|
Loading…
Reference in New Issue