Skip to content

Commit

Permalink
[bugfix] Don't throw error when parent statuses are missing (#2011) (#…
Browse files Browse the repository at this point in the history
…3088)

* [bugfix] Don't throw error when parent statuses are missing (#2011)

* Split missing parent status case from error check
  • Loading branch information
snowkat authored Jul 10, 2024
1 parent ad93e57 commit 8f8093a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/db/bundb/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status)
gtscontext.SetBarebones(ctx),
status.InReplyToID,
)
if err != nil {
if err != nil && !errors.Is(err, db.ErrNoEntries) {
errs.Appendf("error populating status parent: %w", err)
}
}
Expand Down Expand Up @@ -561,10 +561,15 @@ func (s *statusDB) GetStatusParents(ctx context.Context, status *gtsmodel.Status

for id := status.InReplyToID; id != ""; {
parent, err := s.GetStatusByID(ctx, id)
if err != nil {
if err != nil && !errors.Is(err, db.ErrNoEntries) {
return nil, err
}

if parent == nil {
// Parent status not found (e.g. deleted)
break
}

// Append parent status to slice
parents = append(parents, parent)

Expand Down

0 comments on commit 8f8093a

Please sign in to comment.