all repos — honk @ 87df21cf386831b24c9fbc8fbbe0e729e99bec0f

my fork of honk

fixup a few more cases where type could be array
Ted Unangst tedu@tedunangst.com
Tue, 03 Oct 2023 21:23:32 -0400
commit

87df21cf386831b24c9fbc8fbbe0e729e99bec0f

parent

ee35ed0c82a3c617d5a38b84d20d079413e7ed48

2 files changed, 8 insertions(+), 8 deletions(-)

jump to
M activity.goactivity.go

@@ -606,8 +606,8 @@ case "Announce":

obj, ok = item.GetMap("object") if ok { // peek ahead some - what, ok := obj.GetString("type") - if ok && (what == "Create" || what == "Update") { + what := firstofmany(obj, "type") + if what == "Create" || what == "Update" { if what == "Update" { isUpdate = true }

@@ -774,7 +774,7 @@ xonk.Public = loudandproud(xonk.Audience)

var mentions []Mention if obj != nil { - ot, _ := obj.GetString("type") + ot := firstofmany(obj, "type") url, _ = obj.GetString("url") if dt2, ok := obj.GetString("published"); ok { dt = dt2
M web.goweb.go

@@ -410,7 +410,7 @@

if crappola(j) { return } - what, _ := j.GetString("type") + what := firstofmany(j, "type") obj, _ := j.GetString("object") if what == "Like" || what == "Dislike" || (what == "EmojiReact" && originate(obj) != serverName) { return

@@ -459,7 +459,7 @@ nofollowyou2(user, j)

case "Update": obj, ok := j.GetMap("object") if ok { - what, _ := obj.GetString("type") + what := firstofmany(obj, "type") switch what { case "Service": fallthrough

@@ -479,7 +479,7 @@ unfollowme(user, "", "", j)

} return } - what, _ := obj.GetString("type") + what := firstofmany(obj, "type") switch what { case "Follow": unfollowme(user, who, who, j)

@@ -556,7 +556,7 @@ if rejectactor(user.ID, who) {

return } re_ont := regexp.MustCompile("https://" + serverName + "/o/([\\pL[:digit:]]+)") - what, _ := j.GetString("type") + what := firstofmany(j, "type") dlog.Printf("server got a %s", what) switch what { case "Follow":

@@ -579,7 +579,7 @@ if !ok {

ilog.Printf("unknown undo no object") return } - what, _ := obj.GetString("type") + what := firstofmany(obj, "type") if what != "Follow" { ilog.Printf("unknown undo: %s", what) return