diff options
author | 2025-02-17 11:44:41 +0000 | |
---|---|---|
committer | 2025-02-17 11:44:41 +0000 | |
commit | e220c6a894de11e871347d8f3c019eae5594eb57 (patch) | |
tree | 438b7e87bc8d48f29fb99e0d5d8e6123e6283f33 /internal/processing/workers | |
parent | [chore]: Bump github.com/spf13/cobra from 1.8.1 to 1.9.1 (#3805) (diff) | |
download | gotosocial-e220c6a894de11e871347d8f3c019eae5594eb57.tar.xz |
adds more code comments and some small code formatting tweaks (#3799)
Diffstat (limited to 'internal/processing/workers')
-rw-r--r-- | internal/processing/workers/fromclientapi.go | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/internal/processing/workers/fromclientapi.go b/internal/processing/workers/fromclientapi.go index a208d97b0..28a2b37b9 100644 --- a/internal/processing/workers/fromclientapi.go +++ b/internal/processing/workers/fromclientapi.go @@ -261,15 +261,17 @@ func (p *clientAPI) CreateUser(ctx context.Context, cMsg *messages.FromClientAPI func (p *clientAPI) CreateStatus(ctx context.Context, cMsg *messages.FromClientAPI) error { var status *gtsmodel.Status - backfill := false - if backfillStatus, ok := cMsg.GTSModel.(*gtsmodel.BackfillStatus); ok { - status = backfillStatus.Status + var backfill bool + + // Check passed client message model type. + switch model := cMsg.GTSModel.(type) { + case *gtsmodel.Status: + status = model + case *gtsmodel.BackfillStatus: + status = model.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) - } + default: + return gtserror.Newf("%T not parseable as *gtsmodel.Status or *gtsmodel.BackfillStatus", cMsg.GTSModel) } // If pending approval is true then status must @@ -351,7 +353,12 @@ func (p *clientAPI) CreateStatus(ctx context.Context, cMsg *messages.FromClientA log.Errorf(ctx, "error updating account stats: %v", err) } + // We specifically do not timeline + // or notify for backfilled statuses, + // as these are more for archival than + // newly posted content for user feeds. if !backfill { + if err := p.surface.timelineAndNotifyStatus(ctx, status); err != nil { log.Errorf(ctx, "error timelining and notifying status: %v", err) } |