summaryrefslogtreecommitdiff
path: root/internal/processing
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-04-08 11:51:51 +0200
committerLibravatar GitHub <noreply@github.com>2024-04-08 11:51:51 +0200
commit6db7d014dca9a2954ea7b5cd110a48e3d84673bf (patch)
treeba01923cee3d4ae6cbe49cdfa805e6a379264e9b /internal/processing
parent[bugfix] temporarily replace `modernc.org/sqlite-v1.29.5` with `gitlab.com/Ny... (diff)
downloadgotosocial-6db7d014dca9a2954ea7b5cd110a48e3d84673bf.tar.xz
[bugfix] Ensure side effects for local -> local follows get processed (#2820)v0.15.0-rc2
Diffstat (limited to 'internal/processing')
-rw-r--r--internal/processing/account/follow.go2
-rw-r--r--internal/processing/account/follow_test.go36
2 files changed, 37 insertions, 1 deletions
diff --git a/internal/processing/account/follow.go b/internal/processing/account/follow.go
index 8006f8d79..7f28bb2c0 100644
--- a/internal/processing/account/follow.go
+++ b/internal/processing/account/follow.go
@@ -114,7 +114,7 @@ func (p *Processor) FollowCreate(ctx context.Context, requestingAccount *gtsmode
err = gtserror.Newf("error accepting follow request for local unlocked account: %w", err)
return nil, gtserror.NewErrorInternalError(err)
}
- } else if targetAccount.IsRemote() {
+ } else {
// Otherwise we leave the follow request as it is,
// and we handle the rest of the process async.
p.state.Workers.EnqueueClientAPI(ctx, messages.FromClientAPI{
diff --git a/internal/processing/account/follow_test.go b/internal/processing/account/follow_test.go
index ed6b62304..c269dc710 100644
--- a/internal/processing/account/follow_test.go
+++ b/internal/processing/account/follow_test.go
@@ -20,9 +20,12 @@ package account_test
import (
"context"
"testing"
+ "time"
"github.com/stretchr/testify/suite"
+ "github.com/superseriousbusiness/gotosocial/internal/ap"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
+ "github.com/superseriousbusiness/gotosocial/internal/messages"
"github.com/superseriousbusiness/gotosocial/internal/util"
)
@@ -130,6 +133,39 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowSetNothing() {
suite.False(relationship.Notifying)
}
+func (suite *FollowTestSuite) TestFollowRequestLocal() {
+ ctx := context.Background()
+ requestingAccount := suite.testAccounts["admin_account"]
+ targetAccount := suite.testAccounts["local_account_2"]
+
+ // Have admin follow request turtle.
+ _, err := suite.accountProcessor.FollowCreate(
+ ctx,
+ requestingAccount,
+ &apimodel.AccountFollowRequest{
+ ID: targetAccount.ID,
+ Reblogs: util.Ptr(true),
+ Notify: util.Ptr(false),
+ })
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ // There should be a message going to the worker.
+ var cMsg messages.FromClientAPI
+ select {
+ case cMsg = <-suite.fromClientAPIChan:
+ // No problem.
+ case <-time.After(5 * time.Second):
+ suite.FailNow("timed out waiting for message")
+ }
+
+ suite.Equal(ap.ActivityCreate, cMsg.APActivityType)
+ suite.Equal(ap.ActivityFollow, cMsg.APObjectType)
+ suite.Equal(requestingAccount.ID, cMsg.OriginAccount.ID)
+ suite.Equal(targetAccount.ID, cMsg.TargetAccount.ID)
+}
+
func TestFollowTestS(t *testing.T) {
suite.Run(t, new(FollowTestSuite))
}