summaryrefslogtreecommitdiff
path: root/internal/federation/federatingdb/get.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-07-26 12:04:28 +0200
committerLibravatar GitHub <noreply@github.com>2024-07-26 12:04:28 +0200
commit8ab2b19a946251f258446d22f420d401f61d22f6 (patch)
tree39fb674f135fd1cfcf4de5b319913f0d0c17d11a /internal/federation/federatingdb/get.go
parent[docs] Add separate migration section + instructions for moving to GtS and no... (diff)
downloadgotosocial-8ab2b19a946251f258446d22f420d401f61d22f6.tar.xz
[feature] Federate interaction policies + Accepts; enforce policies (#3138)
* [feature] Federate interaction policies + Accepts; enforce policies * use Acceptable type * fix index * remove appendIRIStrs * add GetAccept federatingdb function * lock on object IRI
Diffstat (limited to 'internal/federation/federatingdb/get.go')
-rw-r--r--internal/federation/federatingdb/get.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/federation/federatingdb/get.go b/internal/federation/federatingdb/get.go
index eba58853f..5dcebb877 100644
--- a/internal/federation/federatingdb/get.go
+++ b/internal/federation/federatingdb/get.go
@@ -37,22 +37,30 @@ func (f *federatingDB) Get(ctx context.Context, id *url.URL) (value vocab.Type,
l.Debug("entering Get")
switch {
+
case uris.IsUserPath(id):
acct, err := f.state.DB.GetAccountByURI(ctx, id.String())
if err != nil {
return nil, err
}
return f.converter.AccountToAS(ctx, acct)
+
case uris.IsStatusesPath(id):
status, err := f.state.DB.GetStatusByURI(ctx, id.String())
if err != nil {
return nil, err
}
return f.converter.StatusToAS(ctx, status)
+
case uris.IsFollowersPath(id):
return f.Followers(ctx, id)
+
case uris.IsFollowingPath(id):
return f.Following(ctx, id)
+
+ case uris.IsAcceptsPath(id):
+ return f.GetAccept(ctx, id)
+
default:
return nil, fmt.Errorf("federatingDB: could not Get %s", id.String())
}