From 87177d840b9703f572392ef4bd0f5013fd5c3a77 Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 28 May 2021 19:57:04 +0200 Subject: Announce/boost (#35) Remote boosts incoming/outgoing now working. --- internal/federation/federatingdb/util.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'internal/federation/federatingdb/util.go') diff --git a/internal/federation/federatingdb/util.go b/internal/federation/federatingdb/util.go index be3cff944..53fe194a7 100644 --- a/internal/federation/federatingdb/util.go +++ b/internal/federation/federatingdb/util.go @@ -130,6 +130,19 @@ func (f *federatingDB) NewID(c context.Context, t vocab.Type) (id *url.URL, err return idProp.GetIRI(), nil } } + case gtsmodel.ActivityStreamsAnnounce: + // ANNOUNCE aka BOOST + // ID might already be set on an announce we've created, so check it here and return it if it is + announce, ok := t.(vocab.ActivityStreamsAnnounce) + if !ok { + return nil, errors.New("newid: fave couldn't be parsed into vocab.ActivityStreamsAnnounce") + } + idProp := announce.GetJSONLDId() + if idProp != nil { + if idProp.IsIRI() { + return idProp.GetIRI(), nil + } + } } // fallback default behavior: just return a random UUID after our protocol and host -- cgit v1.2.3