From 1e9646596b8b32cea18a17099129b5171c26f128 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Sat, 25 Jan 2025 23:24:49 -0800 Subject: [PATCH] Forbid mentioning others in backfills --- internal/processing/status/create.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/processing/status/create.go b/internal/processing/status/create.go index 249f20710..110375119 100644 --- a/internal/processing/status/create.go +++ b/internal/processing/status/create.go @@ -161,6 +161,18 @@ func (p *Processor) Create( PendingApproval: util.Ptr(false), } + if backfill { + log.Infof(ctx, "%d mentions", len(status.Mentions)) + for _, mention := range status.Mentions { + log.Infof(ctx, "mention: target account ID = %s, requester ID = %s", mention.TargetAccountID, requester.ID) + if mention.TargetAccountID != requester.ID { + const errText = "statuses mentioning others can't be backfilled" + err := gtserror.New(errText) + return nil, gtserror.NewErrorBadRequest(err, errText) + } + } + } + // Check + attach in-reply-to status. if errWithCode := p.processInReplyTo(ctx, requester, @@ -194,7 +206,7 @@ func (p *Processor) Create( if form.Poll != nil { if backfill { - const errText = "posts with polls can't be backfilled" + const errText = "statuses with polls can't be backfilled" err := gtserror.New(errText) return nil, gtserror.NewErrorBadRequest(err, errText) }