[bugfix] Fix dereferencing ancestors on new status create (#2652)

* [bugfix] Pass `latest` to dereferenceThread instead of barebones status

* only mark status orphaned if visibility suggests parent is really deleted

* tone down "not deref'd" warnings, since they represent a legit visibility situation

* remove FAQ entry for "status not deref'd yet"
This commit is contained in:
tobi 2024-02-18 10:49:40 +01:00 committed by GitHub
parent 83a4adbd95
commit 40f9eefc21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 31 additions and 10 deletions

View File

@ -50,10 +50,6 @@ Take a look at the [list of open bugs](https://github.com/superseriousbusiness/g
These warnings are caused by Mastodon forgetting to take query parameters into account when signing HTTP requests. Fixes on both Mastodon and GoToSocial sides are in the works, and other instance software is expected to follow. These warnings are caused by Mastodon forgetting to take query parameters into account when signing HTTP requests. Fixes on both Mastodon and GoToSocial sides are in the works, and other instance software is expected to follow.
## Warnings “status not yet deref'd” in the logs
The warning is mostly to say that the derived visibility of the given status may not be entirely accurate due to a parent not being dereferenced yet, so do not worry about it.
## Will you support tables in Markdown? ## Will you support tables in Markdown?
Not at the moment, as most clients handle them terribly. Not at the moment, as most clients handle them terribly.

View File

@ -222,7 +222,7 @@ func (d *Dereferencer) RefreshStatus(
d.dereferenceThread(ctx, d.dereferenceThread(ctx,
requestUser, requestUser,
uri, uri,
status, latest,
statusable, statusable,
isNew, isNew,
) )

View File

@ -124,9 +124,34 @@ func (d *Dereferencer) DereferenceStatusAncestors(ctx context.Context, username
// Check for a returned HTTP code via error. // Check for a returned HTTP code via error.
switch code := gtserror.StatusCode(err); { switch code := gtserror.StatusCode(err); {
// Status codes 404 and 410 incicate the status does not exist anymore. // 404 may indicate deletion, but can also
// Gone (410) is the preferred for deletion, but we accept NotFound too. // indicate that we don't have permission to
case code == http.StatusNotFound || code == http.StatusGone: // 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") l.Trace("status orphaned")
current.InReplyToID = "" current.InReplyToID = ""
current.InReplyToURI = "" current.InReplyToURI = ""

View File

@ -156,7 +156,7 @@ func (f *Filter) isStatusHomeTimelineable(ctx context.Context, owner *gtsmodel.A
// Check parent is deref'd. // Check parent is deref'd.
if next.InReplyToID == "" { 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 return false, cache.SentinelError
} }

View File

@ -95,7 +95,7 @@ func (f *Filter) isStatusPublicTimelineable(ctx context.Context, requester *gtsm
// Fetch next parent to lookup. // Fetch next parent to lookup.
parentID := parent.InReplyToID parentID := parent.InReplyToID
if parentID == "" { 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 return false, cache.SentinelError
} }