mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 12:52:27 -05:00
[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
This commit is contained in:
parent
f8d399cf6a
commit
8ab2b19a94
42 changed files with 3541 additions and 254 deletions
|
|
@ -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())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue