move to ssb gofed fork (#298)

This commit is contained in:
tobi 2021-11-13 17:29:43 +01:00 committed by GitHub
commit 09ef9e639e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
799 changed files with 6458 additions and 2475 deletions

View file

@ -22,8 +22,9 @@ import (
"context"
"net/url"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/db"
)
// InboxContains returns true if the OrderedCollection at 'inbox'
@ -56,3 +57,25 @@ func (f *federatingDB) GetInbox(c context.Context, inboxIRI *url.URL) (inbox voc
func (f *federatingDB) SetInbox(c context.Context, inbox vocab.ActivityStreamsOrderedCollectionPage) error {
return nil
}
// InboxForActor fetches the inbox corresponding to the given actorIRI.
//
// It is acceptable to just return nil for the inboxIRI. In this case, the library will
// attempt to resolve the inbox of the actor by remote dereferencing instead.
//
// The library makes this call only after acquiring a lock first.
func (f *federatingDB) InboxForActor(c context.Context, actorIRI *url.URL) (inboxIRI *url.URL, err error) {
account, err := f.db.GetAccountByURI(c, actorIRI.String())
if err != nil {
// if there are just no entries for this account yet it's fine, return nil
// and go-fed will try to dereference it instead
if err == db.ErrNoEntries {
return nil, nil
}
// there's been an actual error...
return nil, err
}
// we got it!
return url.Parse(account.InboxURI)
}