summaryrefslogtreecommitdiff
path: root/internal/visibility/statushometimelineable.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/visibility/statushometimelineable.go')
-rw-r--r--internal/visibility/statushometimelineable.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/internal/visibility/statushometimelineable.go b/internal/visibility/statushometimelineable.go
index bd3c90b4d..dabb1fa4b 100644
--- a/internal/visibility/statushometimelineable.go
+++ b/internal/visibility/statushometimelineable.go
@@ -21,17 +21,27 @@ package visibility
import (
"context"
"fmt"
+ "time"
"codeberg.org/gruf/go-kv"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
+ "github.com/superseriousbusiness/gotosocial/internal/id"
"github.com/superseriousbusiness/gotosocial/internal/log"
)
func (f *filter) StatusHometimelineable(ctx context.Context, targetStatus *gtsmodel.Status, timelineOwnerAccount *gtsmodel.Account) (bool, error) {
- l := log.WithFields(kv.Fields{
+ l := log.WithFields(kv.Fields{{"statusID", targetStatus.ID}}...)
- {"statusID", targetStatus.ID},
- }...)
+ // don't timeline statuses more than 5 min in the future
+ maxID, err := id.NewULIDFromTime(time.Now().Add(5 * time.Minute))
+ if err != nil {
+ return false, err
+ }
+
+ if targetStatus.ID > maxID {
+ l.Debug("status not hometimelineable because it's from more than 5 minutes in the future")
+ return false, nil
+ }
// status owner should always be able to see their own status in their timeline so we can return early if this is the case
if targetStatus.AccountID == timelineOwnerAccount.ID {