diff options
author | 2024-07-10 06:38:25 -0700 | |
---|---|---|
committer | 2024-07-10 14:38:25 +0100 | |
commit | 8f8093aea46adfe82f04f0fb720ae320816f46ae (patch) | |
tree | 096924ec3e493264ab24903906561c9efe535967 | |
parent | [choore] Update robots.txt (#3092) (diff) | |
download | gotosocial-8f8093aea46adfe82f04f0fb720ae320816f46ae.tar.xz |
[bugfix] Don't throw error when parent statuses are missing (#2011) (#3088)
* [bugfix] Don't throw error when parent statuses are missing (#2011)
* Split missing parent status case from error check
-rw-r--r-- | internal/db/bundb/status.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/db/bundb/status.go b/internal/db/bundb/status.go index 512730dd5..dfb97cff1 100644 --- a/internal/db/bundb/status.go +++ b/internal/db/bundb/status.go @@ -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) } } @@ -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) |