diff options
author | 2023-11-08 14:32:17 +0000 | |
---|---|---|
committer | 2023-11-08 14:32:17 +0000 | |
commit | e9e5dc5a40926e5320cb131b035c46b1e1b0bd59 (patch) | |
tree | 52edc9fa5742f28e1e5223f51cda628ec1c35a24 /internal/db/bundb/status.go | |
parent | [chore]: Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#2338) (diff) | |
download | gotosocial-e9e5dc5a40926e5320cb131b035c46b1e1b0bd59.tar.xz |
[feature] add support for polls + receiving federated status edits (#2330)
Diffstat (limited to 'internal/db/bundb/status.go')
-rw-r--r-- | internal/db/bundb/status.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/db/bundb/status.go b/internal/db/bundb/status.go index 0bd4ba1a9..7f274d693 100644 --- a/internal/db/bundb/status.go +++ b/internal/db/bundb/status.go @@ -154,17 +154,6 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) } } - if status.InReplyToID != "" && status.InReplyTo == nil { - // Status parent is not set, fetch from database. - status.InReplyTo, err = s.GetStatusByID( - gtscontext.SetBarebones(ctx), - status.InReplyToID, - ) - if err != nil { - errs.Appendf("error populating status parent: %w", err) - } - } - if status.InReplyToID != "" { if status.InReplyTo == nil { // Status parent is not set, fetch from database. @@ -213,6 +202,17 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) } } + if status.PollID != "" && status.Poll == nil { + // Status poll is not set, fetch from database. + status.Poll, err = s.state.DB.GetPollByID( + gtscontext.SetBarebones(ctx), + status.PollID, + ) + if err != nil { + errs.Appendf("error populating status poll: %w", err) + } + } + if !status.AttachmentsPopulated() { // Status attachments are out-of-date with IDs, repopulate. status.Attachments, err = s.state.DB.GetAttachmentsByIDs( |