summaryrefslogtreecommitdiff
path: root/internal/federation/dereferencing/status.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-01-09 09:42:39 +0000
committerLibravatar GitHub <noreply@github.com>2024-01-09 10:42:39 +0100
commit10660e566d21c79ff86a8e69ea073cf562fc2766 (patch)
treeb540e4d5fedd64b47764ef054a69141ed97ff8cd /internal/federation/dereferencing/status.go
parent[bugfix] Outdent placeholder from `<aside>` when returning unknown media atta... (diff)
downloadgotosocial-10660e566d21c79ff86a8e69ea073cf562fc2766.tar.xz
[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
Diffstat (limited to 'internal/federation/dereferencing/status.go')
-rw-r--r--internal/federation/dereferencing/status.go17
1 files changed, 11 insertions, 6 deletions
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
}