can simplify the reverb logic some

This commit is contained in:
Ted Unangst 2019-12-01 12:34:08 -05:00
parent d164471a92
commit d5d943b203
1 changed files with 16 additions and 21 deletions

37
fun.go
View File

@ -63,32 +63,27 @@ func reverbolate(userid int64, honks []*Honk) {
} }
translate(h, false) translate(h, false)
local := false local := false
if (h.Whofore == 2 || h.Whofore == 3) || h.What != "bonked" { if (h.Whofore == 2 || h.Whofore == 3) && h.What != "bonked" {
local = true local = true
} }
if h.Whofore == 2 || h.Whofore == 3 { if local {
h.URL = h.XID h.Noise = re_memes.ReplaceAllString(h.Noise, "")
if h.What != "bonked" { h.Noise = mentionize(h.Noise)
h.Noise = re_memes.ReplaceAllString(h.Noise, "") h.Noise = ontologize(h.Noise)
h.Noise = mentionize(h.Noise) }
h.Noise = ontologize(h.Noise) h.Username, h.Handle = handles(h.Honker)
} short := shortname(userid, h.Honker)
h.Username, h.Handle = handles(h.Honker) if short != "" {
h.Username = short
} else { } else {
_, h.Handle = handles(h.Honker) h.Username = h.Handle
short := shortname(userid, h.Honker) if len(h.Username) > 20 {
if short != "" { h.Username = h.Username[:20] + ".."
h.Username = short
} else {
h.Username = h.Handle
if len(h.Username) > 20 {
h.Username = h.Username[:20] + ".."
}
}
if h.URL == "" {
h.URL = h.XID
} }
} }
if h.URL == "" {
h.URL = h.XID
}
if h.Oonker != "" { if h.Oonker != "" {
_, h.Oondle = handles(h.Oonker) _, h.Oondle = handles(h.Oonker)
} }