From 5139949a5a187317cae71d6d8427ace56010c66c Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 6 Nov 2019 15:17:53 -0500 Subject: [PATCH] let's try to stick with AP/AS defined locations --- activity.go | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/activity.go b/activity.go index b08d217..f598957 100644 --- a/activity.go +++ b/activity.go @@ -1061,21 +1061,25 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { t["icon"] = i tags = append(tags, t) } + if len(tags) > 0 { + jo["tag"] = tags + } if p := h.Place; p != nil { t := junk.New() t["type"] = "Place" - t["name"] = p.Name - t["latitude"] = p.Latitude - t["longitude"] = p.Longitude - t["url"] = p.Url - if h.What == "event" { - jo["location"] = t - } else { - tags = append(tags, t) + if p.Name != "" { + t["name"] = p.Name } - } - if len(tags) > 0 { - jo["tag"] = tags + if p.Latitude != 0 { + t["latitude"] = p.Latitude + } + if p.Longitude != 0 { + t["longitude"] = p.Longitude + } + if p.Url != "" { + t["url"] = p.Url + } + jo["location"] = t } if t := h.Time; t != nil { jo["startTime"] = t.StartTime.Format(time.RFC3339)