handle the case where the tag is just an object

This commit is contained in:
Ted Unangst 2023-07-29 15:04:11 -04:00
parent d5a2c8694c
commit 92b1c61dc1
1 changed files with 13 additions and 6 deletions

View File

@ -967,12 +967,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
procatt(att) procatt(att)
} }
} }
tags, _ := obj.GetArray("tag") proctag := func(tag junk.Junk) {
for _, tagi := range tags {
tag, ok := tagi.(junk.Junk)
if !ok {
continue
}
tt, _ := tag.GetString("type") tt, _ := tag.GetString("type")
name, _ := tag.GetString("name") name, _ := tag.GetString("name")
desc, _ := tag.GetString("summary") desc, _ := tag.GetString("summary")
@ -1017,6 +1012,18 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
mentions = append(mentions, m) mentions = append(mentions, m)
} }
} }
tags, _ := obj.GetArray("tag")
for _, tagi := range tags {
tag, ok := tagi.(junk.Junk)
if !ok {
continue
}
proctag(tag)
}
tag, ok := obj.GetMap("tag")
if ok {
proctag(tag)
}
if starttime, ok := obj.GetString("startTime"); ok { if starttime, ok := obj.GetString("startTime"); ok {
if start, err := time.Parse(time.RFC3339, starttime); err == nil { if start, err := time.Parse(time.RFC3339, starttime); err == nil {
t := new(Time) t := new(Time)