mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] Prevent future statuses entering timelines (#1134)
* [bugfix] Prevent future statuses entering timeline Statuses created more than 5 minutes into the future are now rejected in the visibility package. * Come on buddy
This commit is contained in:
@@ -21,10 +21,12 @@ package visibility_test
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/ap"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/id"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
@@ -65,6 +67,44 @@ func (suite *StatusStatusHometimelineableTestSuite) TestNotFollowingStatusHometi
|
||||
suite.False(timelineable)
|
||||
}
|
||||
|
||||
func (suite *StatusStatusHometimelineableTestSuite) TestStatusTooNewNotTimelineable() {
|
||||
testStatus := >smodel.Status{}
|
||||
*testStatus = *suite.testStatuses["local_account_1_status_1"]
|
||||
|
||||
var err error
|
||||
testStatus.ID, err = id.NewULIDFromTime(time.Now().Add(10 * time.Minute))
|
||||
if err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
ctx := context.Background()
|
||||
|
||||
timelineable, err := suite.filter.StatusHometimelineable(ctx, testStatus, testAccount)
|
||||
suite.NoError(err)
|
||||
|
||||
suite.False(timelineable)
|
||||
}
|
||||
|
||||
func (suite *StatusStatusHometimelineableTestSuite) TestStatusNotTooNewTimelineable() {
|
||||
testStatus := >smodel.Status{}
|
||||
*testStatus = *suite.testStatuses["local_account_1_status_1"]
|
||||
|
||||
var err error
|
||||
testStatus.ID, err = id.NewULIDFromTime(time.Now().Add(4 * time.Minute))
|
||||
if err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
ctx := context.Background()
|
||||
|
||||
timelineable, err := suite.filter.StatusHometimelineable(ctx, testStatus, testAccount)
|
||||
suite.NoError(err)
|
||||
|
||||
suite.True(timelineable)
|
||||
}
|
||||
|
||||
func (suite *StatusStatusHometimelineableTestSuite) TestChainReplyFollowersOnly() {
|
||||
ctx := context.Background()
|
||||
|
||||
|
Reference in New Issue
Block a user