From 10660e566d21c79ff86a8e69ea073cf562fc2766 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:42:39 +0000 Subject: [bugfix] misc dereferencer fixes (#2475) * only perform status-up-to-date checks if no statusable has been provided * copy over the same style of freshness checking from status deref -> accounts * change some var names * check for empty account domain --- internal/federation/dereferencing/status.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'internal/federation/dereferencing/status.go') diff --git a/internal/federation/dereferencing/status.go b/internal/federation/dereferencing/status.go index 2a2b99d25..1eb7d6fdb 100644 --- a/internal/federation/dereferencing/status.go +++ b/internal/federation/dereferencing/status.go @@ -135,12 +135,13 @@ func (d *Dereferencer) getStatusByURI(ctx context.Context, requestUser string, u }, nil) } - // Check whether needs update. if statusUpToDate(status, false) { - // This is existing up-to-date status, ensure it is populated. + // This is an existing status that is up-to-date, + // before returning ensure it is fully populated. if err := d.state.DB.PopulateStatus(ctx, status); err != nil { log.Errorf(ctx, "error populating existing status: %v", err) } + return status, nil, false, nil } @@ -170,8 +171,10 @@ func (d *Dereferencer) RefreshStatus( statusable ap.Statusable, force bool, ) (*gtsmodel.Status, ap.Statusable, error) { - // Check whether status needs update. - if statusUpToDate(status, force) { + // If no incoming data is provided, + // check whether status needs update. + if statusable == nil && + statusUpToDate(status, force) { return status, nil, nil } @@ -215,8 +218,10 @@ func (d *Dereferencer) RefreshStatusAsync( statusable ap.Statusable, force bool, ) { - // Check whether status needs update. - if statusUpToDate(status, force) { + // If no incoming data is provided, + // check whether status needs update. + if statusable == nil && + statusUpToDate(status, force) { return } -- cgit v1.2.3