summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-08-25 12:18:39 +0200
committerLibravatar GitHub <noreply@github.com>2024-08-25 12:18:39 +0200
commitbef0dfc66cd7fd11d17fa1cb900d582071a8d5ba (patch)
treea22208b570fe969dc8894392b83750d49cb0a815
parent[chore/bugfix] Fix missing insertion of preapproved interaction requests (#3228) (diff)
downloadgotosocial-bef0dfc66cd7fd11d17fa1cb900d582071a8d5ba.tar.xz
[bugfix] Carry-over `ApprovedByURI` to avoid marking already-approved remote statuses as pending approval (#3231)
* [bugfix] Carry-over pendingApproval + approvedByURI to avoid pending already-approved remote statuses * don't carry over pending_approval, not necessary * comment
-rw-r--r--internal/federation/dereferencing/status.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/federation/dereferencing/status.go b/internal/federation/dereferencing/status.go
index fa9906066..271ced21a 100644
--- a/internal/federation/dereferencing/status.go
+++ b/internal/federation/dereferencing/status.go
@@ -514,6 +514,17 @@ func (d *Dereferencer) enrichStatus(
latestStatus.FetchedAt = time.Now()
latestStatus.Local = status.Local
+ // Carry-over approvals. Remote instances might not yet
+ // serve statuses with the `approved_by` field, but we
+ // might have marked a status as pre-approved on our side
+ // based on the author's inclusion in a followers/following
+ // collection. By carrying over previously-set values we
+ // can avoid marking such statuses as "pending" again.
+ //
+ // If a remote has in the meantime retracted its approval,
+ // the next call to 'isPermittedStatus' will catch that.
+ latestStatus.ApprovedByURI = status.ApprovedByURI
+
// Check if this is a permitted status we should accept.
// Function also sets "PendingApproval" bool as necessary.
permit, err := d.isPermittedStatus(ctx, requestUser, status, latestStatus)