From d5d943b2033b92f8387d78041a2b66154cc3ab6d Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sun, 1 Dec 2019 12:34:08 -0500 Subject: [PATCH] can simplify the reverb logic some --- fun.go | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/fun.go b/fun.go index 5ae0941..2cbc237 100644 --- a/fun.go +++ b/fun.go @@ -63,32 +63,27 @@ func reverbolate(userid int64, honks []*Honk) { } translate(h, 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 } - if h.Whofore == 2 || h.Whofore == 3 { - h.URL = h.XID - if h.What != "bonked" { - h.Noise = re_memes.ReplaceAllString(h.Noise, "") - h.Noise = mentionize(h.Noise) - h.Noise = ontologize(h.Noise) - } - h.Username, h.Handle = handles(h.Honker) + if local { + h.Noise = re_memes.ReplaceAllString(h.Noise, "") + h.Noise = mentionize(h.Noise) + h.Noise = ontologize(h.Noise) + } + h.Username, h.Handle = handles(h.Honker) + short := shortname(userid, h.Honker) + if short != "" { + h.Username = short } else { - _, h.Handle = handles(h.Honker) - short := shortname(userid, h.Honker) - if short != "" { - 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 + h.Username = h.Handle + if len(h.Username) > 20 { + h.Username = h.Username[:20] + ".." } } + if h.URL == "" { + h.URL = h.XID + } if h.Oonker != "" { _, h.Oondle = handles(h.Oonker) }