diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/federation/dereferencing/status.go | 2 | ||||
-rw-r--r-- | internal/federation/dereferencing/thread.go | 31 | ||||
-rw-r--r-- | internal/visibility/home_timeline.go | 2 | ||||
-rw-r--r-- | internal/visibility/public_timeline.go | 2 |
4 files changed, 31 insertions, 6 deletions
diff --git a/internal/federation/dereferencing/status.go b/internal/federation/dereferencing/status.go index 6d3dd5691..e3f97553d 100644 --- a/internal/federation/dereferencing/status.go +++ b/internal/federation/dereferencing/status.go @@ -222,7 +222,7 @@ func (d *Dereferencer) RefreshStatus( d.dereferenceThread(ctx, requestUser, uri, - status, + latest, statusable, isNew, ) diff --git a/internal/federation/dereferencing/thread.go b/internal/federation/dereferencing/thread.go index 2814c0e7d..28f7ffa8a 100644 --- a/internal/federation/dereferencing/thread.go +++ b/internal/federation/dereferencing/thread.go @@ -124,9 +124,34 @@ func (d *Dereferencer) DereferenceStatusAncestors(ctx context.Context, username // Check for a returned HTTP code via error. switch code := gtserror.StatusCode(err); { - // Status codes 404 and 410 incicate the status does not exist anymore. - // Gone (410) is the preferred for deletion, but we accept NotFound too. - case code == http.StatusNotFound || code == http.StatusGone: + // 404 may indicate deletion, but can also + // indicate that we don't have permission to + // view the status (it's followers-only and + // we don't follow, for example). + case code == http.StatusNotFound: + // If this reply is followers-only or stricter, + // we can safely assume the status it replies + // to is also followers only or stricter. + // + // In this case we should leave the inReplyTo + // URI in place for visibility filtering, + // and just return since we can go no further. + if status.Visibility == gtsmodel.VisibilityFollowersOnly || + status.Visibility == gtsmodel.VisibilityMutualsOnly || + status.Visibility == gtsmodel.VisibilityDirect { + return nil + } + + // If the reply is public or unlisted then + // likely the replied-to status is/was public + // or unlisted and has indeed been deleted, + // fall through to the Gone case to clean up. + fallthrough + + // Gone (410) definitely indicates deletion. + // Update the status to remove references to + // the now-gone parent. + case code == http.StatusGone: l.Trace("status orphaned") current.InReplyToID = "" current.InReplyToURI = "" diff --git a/internal/visibility/home_timeline.go b/internal/visibility/home_timeline.go index 3cecbb5de..0a3fbde4e 100644 --- a/internal/visibility/home_timeline.go +++ b/internal/visibility/home_timeline.go @@ -156,7 +156,7 @@ func (f *Filter) isStatusHomeTimelineable(ctx context.Context, owner *gtsmodel.A // Check parent is deref'd. if next.InReplyToID == "" { - log.Warnf(ctx, "status not yet deref'd: %s", next.InReplyToURI) + log.Debugf(ctx, "status not (yet) deref'd: %s", next.InReplyToURI) return false, cache.SentinelError } diff --git a/internal/visibility/public_timeline.go b/internal/visibility/public_timeline.go index b2c05d51f..bad7cf991 100644 --- a/internal/visibility/public_timeline.go +++ b/internal/visibility/public_timeline.go @@ -95,7 +95,7 @@ func (f *Filter) isStatusPublicTimelineable(ctx context.Context, requester *gtsm // Fetch next parent to lookup. parentID := parent.InReplyToID if parentID == "" { - log.Warnf(ctx, "status not yet deref'd: %s", parent.InReplyToURI) + log.Debugf(ctx, "status not (yet) deref'd: %s", parent.InReplyToURI) return false, cache.SentinelError } |