diff options
author | 2021-10-04 15:24:19 +0200 | |
---|---|---|
committer | 2021-10-04 15:24:19 +0200 | |
commit | e04b187702acb0c9908237a35b3a9857e2167b3f (patch) | |
tree | 29839b8d5bbc28d34aba759a48dd7b005f1444f5 /internal/federation/federatingdb/inbox.go | |
parent | Follow request auto approval (#259) (diff) | |
download | gotosocial-e04b187702acb0c9908237a35b3a9857e2167b3f.tar.xz |
Refactor/tidy (#261)
* tidy up streaming
* cut down code duplication
* test get followers/following
* test streaming processor
* fix some test models
* add TimeMustParse
* fix uri / url typo
* make trace logging less verbose
* make logging more consistent
* disable quote on logging
* remove context.Background
* remove many extraneous mastodon references
* regenerate swagger
* don't log query on no rows result
* log latency first for easier reading
Diffstat (limited to 'internal/federation/federatingdb/inbox.go')
-rw-r--r-- | internal/federation/federatingdb/inbox.go | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/internal/federation/federatingdb/inbox.go b/internal/federation/federatingdb/inbox.go index 4390a8b4b..95886b571 100644 --- a/internal/federation/federatingdb/inbox.go +++ b/internal/federation/federatingdb/inbox.go @@ -20,44 +20,19 @@ package federatingdb import ( "context" - "fmt" "net/url" - "github.com/go-fed/activity/pub" "github.com/go-fed/activity/streams" "github.com/go-fed/activity/streams/vocab" - "github.com/sirupsen/logrus" - "github.com/superseriousbusiness/gotosocial/internal/util" ) // InboxContains returns true if the OrderedCollection at 'inbox' // contains the specified 'id'. // // The library makes this call only after acquiring a lock first. +// +// Implementation note: we have our own logic for inboxes so always return false here. func (f *federatingDB) InboxContains(c context.Context, inbox, id *url.URL) (contains bool, err error) { - l := f.log.WithFields( - logrus.Fields{ - "func": "InboxContains", - "id": id.String(), - }, - ) - l.Debugf("entering INBOXCONTAINS function with for inbox %s and id %s", inbox.String(), id.String()) - - if !util.IsInboxPath(inbox) { - return false, fmt.Errorf("%s is not an inbox URI", inbox.String()) - } - - activityI := c.Value(util.APActivity) - if activityI == nil { - return false, fmt.Errorf("no activity was set for id %s", id.String()) - } - activity, ok := activityI.(pub.Activity) - if !ok || activity == nil { - return false, fmt.Errorf("could not parse contextual activity for id %s", id.String()) - } - - l.Debugf("activity type %s for id %s", activity.GetTypeName(), id.String()) - return false, nil } @@ -65,13 +40,9 @@ func (f *federatingDB) InboxContains(c context.Context, inbox, id *url.URL) (con // the specified IRI, for prepending new items. // // The library makes this call only after acquiring a lock first. +// +// Implementation note: we don't (yet) serve inboxes, so just return empty and nil here. func (f *federatingDB) GetInbox(c context.Context, inboxIRI *url.URL) (inbox vocab.ActivityStreamsOrderedCollectionPage, err error) { - l := f.log.WithFields( - logrus.Fields{ - "func": "GetInbox", - }, - ) - l.Debugf("entering GETINBOX function with inboxIRI %s", inboxIRI.String()) return streams.NewActivityStreamsOrderedCollectionPage(), nil } @@ -80,12 +51,8 @@ func (f *federatingDB) GetInbox(c context.Context, inboxIRI *url.URL) (inbox voc // database entries. Separate calls to Create will do that. // // The library makes this call only after acquiring a lock first. +// +// Implementation note: we don't allow inbox setting so just return nil here. func (f *federatingDB) SetInbox(c context.Context, inbox vocab.ActivityStreamsOrderedCollectionPage) error { - l := f.log.WithFields( - logrus.Fields{ - "func": "SetInbox", - }, - ) - l.Debug("entering SETINBOX function") return nil } |