summaryrefslogtreecommitdiff
path: root/internal/processing/workers/fromclientapi.go
diff options
context:
space:
mode:
authorLibravatar Vyr Cossont <VyrCossont@users.noreply.github.com>2025-02-12 09:49:33 -0800
committerLibravatar GitHub <noreply@github.com>2025-02-12 09:49:33 -0800
commitfccb0bc102f2a54a21eed343cda64f9a5221b677 (patch)
treeb7c1858f4a92841dfaf59e7102189a635d7136f8 /internal/processing/workers/fromclientapi.go
parent[performance] improved enum migrations (#3782) (diff)
downloadgotosocial-fccb0bc102f2a54a21eed343cda64f9a5221b677.tar.xz
[feature] Implement backfilling statuses thru scheduled_at (#3685)
* Implement backfilling statuses thru scheduled_at * Forbid mentioning others in backfills * Update error messages & codes * Add new tests for backfilled statuses * Test that backfilling doesn't timeline or notify * Fix check for absence of notification * Test that backfills do not cause federation * Fix type of apimodel.StatusCreateRequest.ScheduledAt in tests * Add config file switch and min date check
Diffstat (limited to 'internal/processing/workers/fromclientapi.go')
-rw-r--r--internal/processing/workers/fromclientapi.go25
1 files changed, 17 insertions, 8 deletions
diff --git a/internal/processing/workers/fromclientapi.go b/internal/processing/workers/fromclientapi.go
index c5dfc157d..a208d97b0 100644
--- a/internal/processing/workers/fromclientapi.go
+++ b/internal/processing/workers/fromclientapi.go
@@ -260,9 +260,16 @@ func (p *clientAPI) CreateUser(ctx context.Context, cMsg *messages.FromClientAPI
}
func (p *clientAPI) CreateStatus(ctx context.Context, cMsg *messages.FromClientAPI) error {
- status, ok := cMsg.GTSModel.(*gtsmodel.Status)
- if !ok {
- return gtserror.Newf("%T not parseable as *gtsmodel.Status", cMsg.GTSModel)
+ var status *gtsmodel.Status
+ backfill := false
+ if backfillStatus, ok := cMsg.GTSModel.(*gtsmodel.BackfillStatus); ok {
+ status = backfillStatus.Status
+ backfill = true
+ } else {
+ status, ok = cMsg.GTSModel.(*gtsmodel.Status)
+ if !ok {
+ return gtserror.Newf("%T not parseable as *gtsmodel.Status or *gtsmodel.BackfillStatus", cMsg.GTSModel)
+ }
}
// If pending approval is true then status must
@@ -344,12 +351,14 @@ func (p *clientAPI) CreateStatus(ctx context.Context, cMsg *messages.FromClientA
log.Errorf(ctx, "error updating account stats: %v", err)
}
- if err := p.surface.timelineAndNotifyStatus(ctx, status); err != nil {
- log.Errorf(ctx, "error timelining and notifying status: %v", err)
- }
+ if !backfill {
+ if err := p.surface.timelineAndNotifyStatus(ctx, status); err != nil {
+ log.Errorf(ctx, "error timelining and notifying status: %v", err)
+ }
- if err := p.federate.CreateStatus(ctx, status); err != nil {
- log.Errorf(ctx, "error federating status: %v", err)
+ if err := p.federate.CreateStatus(ctx, status); err != nil {
+ log.Errorf(ctx, "error federating status: %v", err)
+ }
}
if status.InReplyToID != "" {