summaryrefslogtreecommitdiff
path: root/internal/federation
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-05-28 22:47:18 +0200
committerLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-05-28 22:47:18 +0200
commitcb54324430e7c4640a7aa5aac24932b5e91b71c4 (patch)
treea5193ee09656d808f589de20f77a5a455a5a6683 /internal/federation
parentAnnounce/boost (#35) (diff)
downloadgotosocial-cb54324430e7c4640a7aa5aac24932b5e91b71c4.tar.xz
federate account updates
Diffstat (limited to 'internal/federation')
-rw-r--r--internal/federation/federatingdb/update.go6
-rw-r--r--internal/federation/federatingdb/util.go13
2 files changed, 19 insertions, 0 deletions
diff --git a/internal/federation/federatingdb/update.go b/internal/federation/federatingdb/update.go
index 3ac5f265a..1a148056b 100644
--- a/internal/federation/federatingdb/update.go
+++ b/internal/federation/federatingdb/update.go
@@ -120,6 +120,12 @@ func (f *federatingDB) Update(ctx context.Context, asType vocab.Type) error {
return fmt.Errorf("error converting to account: %s", err)
}
+ if updatedAcct.Domain == f.config.Host {
+ // no need to update local accounts
+ // in fact, if we do this will break the shit out of things so do NOT
+ return nil
+ }
+
if requestingAcct.URI != updatedAcct.URI {
return fmt.Errorf("update for account %s was requested by account %s, this is not valid", updatedAcct.URI, requestingAcct.URI)
}
diff --git a/internal/federation/federatingdb/util.go b/internal/federation/federatingdb/util.go
index 53fe194a7..ff6ae50a6 100644
--- a/internal/federation/federatingdb/util.go
+++ b/internal/federation/federatingdb/util.go
@@ -143,6 +143,19 @@ func (f *federatingDB) NewID(c context.Context, t vocab.Type) (id *url.URL, err
return idProp.GetIRI(), nil
}
}
+ case gtsmodel.ActivityStreamsUpdate:
+ // UPDATE
+ // ID might already be set on an update we've created, so check it here and return it if it is
+ update, ok := t.(vocab.ActivityStreamsUpdate)
+ if !ok {
+ return nil, errors.New("newid: fave couldn't be parsed into vocab.ActivityStreamsUpdate")
+ }
+ idProp := update.GetJSONLDId()
+ if idProp != nil {
+ if idProp.IsIRI() {
+ return idProp.GetIRI(), nil
+ }
+ }
}
// fallback default behavior: just return a random UUID after our protocol and host