mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] check remote status permissibility (#2703)
* add more stringent checks for remote status permissibility * add check for inreplyto of a remote status being a boost * do not permit inReplyTo boost wrapper statuses * change comment wording * fix calls to NewFederator() * add code comments for NotPermitted() and SetNotPermitted() * improve comment * check that existing != nil before attempting delete * ensure replying account isn't suspended * use a debug log instead of info. check for boost using ID * shorten log string length. make info level * add note that replying to boost wrapper status shouldn't be able to happen anyways * update to use onFail() function
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/federation"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/util"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
@@ -60,14 +61,21 @@ func (suite *FederatingActorTestSuite) TestSendNoRemoteFollowers() {
|
||||
tc := testrig.NewTestTransportController(&suite.state, httpClient)
|
||||
|
||||
// setup module being tested
|
||||
federator := federation.NewFederator(&suite.state, testrig.NewTestFederatingDB(&suite.state), tc, suite.typeconverter, testrig.NewTestMediaManager(&suite.state))
|
||||
federator := federation.NewFederator(
|
||||
&suite.state,
|
||||
testrig.NewTestFederatingDB(&suite.state),
|
||||
tc,
|
||||
suite.typeconverter,
|
||||
visibility.NewFilter(&suite.state),
|
||||
testrig.NewTestMediaManager(&suite.state),
|
||||
)
|
||||
|
||||
activity, err := federator.FederatingActor().Send(ctx, testrig.URLMustParse(testAccount.OutboxURI), testActivity)
|
||||
suite.NoError(err)
|
||||
suite.NotNil(activity)
|
||||
|
||||
// because zork has no remote followers, sent messages should be empty (no messages sent to own instance)
|
||||
suite.Empty(httpClient.SentMessages)
|
||||
suite.Empty(&httpClient.SentMessages)
|
||||
}
|
||||
|
||||
func (suite *FederatingActorTestSuite) TestSendRemoteFollower() {
|
||||
@@ -105,8 +113,16 @@ func (suite *FederatingActorTestSuite) TestSendRemoteFollower() {
|
||||
|
||||
httpClient := testrig.NewMockHTTPClient(nil, "../../testrig/media")
|
||||
tc := testrig.NewTestTransportController(&suite.state, httpClient)
|
||||
|
||||
// setup module being tested
|
||||
federator := federation.NewFederator(&suite.state, testrig.NewTestFederatingDB(&suite.state), tc, suite.typeconverter, testrig.NewTestMediaManager(&suite.state))
|
||||
federator := federation.NewFederator(
|
||||
&suite.state,
|
||||
testrig.NewTestFederatingDB(&suite.state),
|
||||
tc,
|
||||
suite.typeconverter,
|
||||
visibility.NewFilter(&suite.state),
|
||||
testrig.NewTestMediaManager(&suite.state),
|
||||
)
|
||||
|
||||
activity, err := federator.FederatingActor().Send(ctx, testrig.URLMustParse(testAccount.OutboxURI), testActivity)
|
||||
suite.NoError(err)
|
||||
|
Reference in New Issue
Block a user