diff options
author | 2024-02-19 11:50:49 +0100 | |
---|---|---|
committer | 2024-02-19 11:50:49 +0100 | |
commit | 0554550acb7811a6dcb3692ecab8bd4218697824 (patch) | |
tree | 9effbc3325a1f3cadfaa4062b4d19092b57f2bb9 /internal/processing/status/create.go | |
parent | [chore]: Bump github.com/jackc/pgx/v5 from 5.5.2 to 5.5.3 (#2664) (diff) | |
download | gotosocial-0554550acb7811a6dcb3692ecab8bd4218697824.tar.xz |
[bugfix] Ensure local statuses always get a threadID so they can be muted (#2665)
* [chore/bugfix] Ensure threadID always set on local statuses
* test
Diffstat (limited to 'internal/processing/status/create.go')
-rw-r--r-- | internal/processing/status/create.go | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/internal/processing/status/create.go b/internal/processing/status/create.go index b450e4bdd..737755852 100644 --- a/internal/processing/status/create.go +++ b/internal/processing/status/create.go @@ -190,18 +190,28 @@ func (p *Processor) processReplyToID(ctx context.Context, form *apimodel.Advance } func (p *Processor) processThreadID(ctx context.Context, status *gtsmodel.Status) gtserror.WithCode { - // Status takes the thread ID - // of whatever it replies to. - if status.InReplyTo != nil { + // Status takes the thread ID of + // whatever it replies to, if set. + // + // Might not be set if status is local + // and replies to a remote status that + // doesn't have a thread ID yet. + // + // If so, we can just thread from this + // status onwards instead, since this + // is where the relevant part of the + // thread starts, from the perspective + // of our instance at least. + if status.InReplyTo != nil && + status.InReplyTo.ThreadID != "" { + // Just inherit threadID from parent. status.ThreadID = status.InReplyTo.ThreadID return nil } - // Status doesn't reply to anything, - // so it's a new local top-level status - // and therefore needs a thread ID. + // Mark new thread (or threaded + // subsection) starting from here. threadID := id.NewULID() - if err := p.state.DB.PutThread( ctx, >smodel.Thread{ |