From 69a193dae543641a2db6823fa6493c02f56fafbd Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 23 Sep 2022 21:27:35 +0200 Subject: [feature] Allow delivery to sharedInboxes where possible (#847) * update Activity * add instance-deliver-to-shared-inboxes setting * update activity version again * add SharedInboxURI field to accounts * serdes for endpoints/sharedInbox * deliver to sharedInbox if one is available * update tests * only assign shared inbox if shared domain * look for shared inbox if currently nil * go fmt * finger to get params.RemoteAccountID if necessary * make comments clearer * compare dns more consistently --- internal/federation/federatingdb/inbox_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'internal/federation/federatingdb/inbox_test.go') diff --git a/internal/federation/federatingdb/inbox_test.go b/internal/federation/federatingdb/inbox_test.go index fb3b96944..dbf9d3c53 100644 --- a/internal/federation/federatingdb/inbox_test.go +++ b/internal/federation/federatingdb/inbox_test.go @@ -63,6 +63,27 @@ func (suite *InboxTestSuite) TestInboxesForAccountIRI() { suite.Contains(asStrings, suite.testAccounts["local_account_1"].InboxURI) } +func (suite *InboxTestSuite) TestInboxesForAccountIRIWithSharedInbox() { + ctx := context.Background() + testAccount := suite.testAccounts["local_account_1"] + sharedInbox := "http://some-inbox-iri/weeeeeeeeeeeee" + testAccount.SharedInboxURI = &sharedInbox + if _, err := suite.db.UpdateAccount(ctx, testAccount); err != nil { + suite.FailNow("error updating account") + } + + inboxIRIs, err := suite.federatingDB.InboxesForIRI(ctx, testrig.URLMustParse(testAccount.URI)) + suite.NoError(err) + + asStrings := []string{} + for _, i := range inboxIRIs { + asStrings = append(asStrings, i.String()) + } + + suite.Len(asStrings, 1) + suite.Contains(asStrings, "http://some-inbox-iri/weeeeeeeeeeeee") +} + func TestInboxTestSuite(t *testing.T) { suite.Run(t, &InboxTestSuite{}) } -- cgit v1.2.3