refine the spicy post logic

This commit is contained in:
Ted Unangst 2019-06-23 19:07:28 -04:00
parent 78e08b4244
commit eb735e538b
2 changed files with 9 additions and 2 deletions

View File

@ -711,7 +711,7 @@ func subsub(user *WhatAbout, xid string) {
deliverate(0, user.Name, xid, msg) deliverate(0, user.Name, xid, msg)
} }
var re_spicy = regexp.MustCompile("^(\U0001f336\ufe0f?){3}") var re_spicy = regexp.MustCompile("^(\U0001f336\ufe0f?){3,}")
func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
dt := h.Date.Format(time.RFC3339) dt := h.Date.Format(time.RFC3339)
@ -753,9 +753,13 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
} }
jo["summary"] = h.Precis jo["summary"] = h.Precis
jo["content"] = mentionize(h.Noise) jo["content"] = mentionize(h.Noise)
if strings.HasPrefix(h.Precis, "DZ:") || re_spicy.MatchString(h.Noise) { if strings.HasPrefix(h.Precis, "DZ:") {
jo["sensitive"] = true
} else if peppers := re_spicy.FindString(h.Noise); peppers != "" {
jo["summary"] = peppers
jo["sensitive"] = true jo["sensitive"] = true
} }
var tags []interface{} var tags []interface{}
g := bunchofgrapes(h.Noise) g := bunchofgrapes(h.Noise)
for _, m := range g { for _, m := range g {

3
fun.go
View File

@ -54,6 +54,9 @@ func reverbolate(honks []*Honk) {
zap := make(map[*Donk]bool) zap := make(map[*Donk]bool)
h.Noise = unpucker(h.Noise) h.Noise = unpucker(h.Noise)
precis := h.Precis precis := h.Precis
if strings.HasPrefix(h.Noise, "<p>" + precis) {
precis = ""
}
if precis != "" { if precis != "" {
if strings.IndexByte(precis, ':') == -1 { if strings.IndexByte(precis, ':') == -1 {
precis = "summary: " + precis precis = "summary: " + precis