[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
This commit is contained in:
kim
2024-01-09 09:42:39 +00:00
committed by GitHub
parent 7cce1a7cc6
commit 10660e566d
2 changed files with 92 additions and 46 deletions

View File

@@ -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
}