From 3d69a879f064cd5529c14c8a16a7ee7607652432 Mon Sep 17 00:00:00 2001 From: tsmethurst Date: Thu, 17 Jun 2021 17:58:50 +0200 Subject: [PATCH] update progress + small fix --- PROGRESS.md | 2 +- internal/visibility/statushometimelineable.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/PROGRESS.md b/PROGRESS.md index 4ccf1e9..c25887d 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -72,7 +72,7 @@ * [x] /api/v1/statuses POST (Create a new status) * [x] /api/v1/statuses/:id GET (View an existing status) * [x] /api/v1/statuses/:id DELETE (Delete a status) - * [ ] /api/v1/statuses/:id/context GET (View statuses above and below status ID) + * [x] /api/v1/statuses/:id/context GET (View statuses above and below status ID) * [x] /api/v1/statuses/:id/reblogged_by GET (See who has reblogged a status) * [x] /api/v1/statuses/:id/favourited_by GET (See who has faved a status) * [x] /api/v1/statuses/:id/favourite POST (Fave a status) diff --git a/internal/visibility/statushometimelineable.go b/internal/visibility/statushometimelineable.go index f349b3a..bc5f7bc 100644 --- a/internal/visibility/statushometimelineable.go +++ b/internal/visibility/statushometimelineable.go @@ -28,7 +28,13 @@ func (f *filter) StatusHometimelineable(targetStatus *gtsmodel.Status, timelineO return false, nil } - // we don't want to timeline a reply to a status whose owner isn't followed by the requesting account + // Don't timeline a status whose parent hasn't been dereferenced yet or can't be dereferenced. + // If we have the reply to URI but don't have an ID for the replied-to account or the replied-to status in our database, we haven't dereferenced it yet. + if targetStatus.InReplyToURI != "" && (targetStatus.InReplyToID == "" || targetStatus.InReplyToAccountID == "") { + return false, nil + } + + // if a status replies to an ID we know in the database, we need to make sure we also follow the replied-to status owner account if targetStatus.InReplyToID != "" { // pin the reply to status on to this status if it hasn't been done already if targetStatus.GTSReplyToStatus == nil { @@ -59,6 +65,7 @@ func (f *filter) StatusHometimelineable(targetStatus *gtsmodel.Status, timelineO return false, fmt.Errorf("StatusHometimelineable: error checking follow from account %s to account %s: %s", timelineOwnerAccount.ID, targetStatus.InReplyToAccountID, err) } + // we don't want to timeline a reply to a status whose owner isn't followed by the requesting account if !follows { return false, nil }