aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade
diff options
context:
space:
mode:
authorwinter2025-03-10 20:29:54 +0000
committerwinter2025-03-10 20:29:54 +0000
commit1685f4f0caa3c64b4919b7005950aa4ee8d4fc29 (patch)
tree55165fdf17485db5d5e8f86c8ccc33c76bd8ecf5 /Digitigrade
parent30fa49bc3fa4f94184d693932e838c0672f24a16 (diff)
send new follow status in follow endpoint
to mitigate desynchronisation issues, which could otherwise cause one instance to think its request is pending while the other instance thinks it's active
Diffstat (limited to 'Digitigrade')
-rw-r--r--Digitigrade/Model/Actor.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/Digitigrade/Model/Actor.php b/Digitigrade/Model/Actor.php
index 2b9a867..229582c 100644
--- a/Digitigrade/Model/Actor.php
+++ b/Digitigrade/Model/Actor.php
@@ -153,6 +153,9 @@ class Actor extends PushableModel implements RpcReceiver {
switch ($method) {
case 'follow':
$status = $this->requestToFollow ? FollowRelationStatus::PENDING : FollowRelationStatus::ACTIVE;
+ if (strlen(trim($result->body)) > 0) { // remote server returned new status, use that instead
+ $status = FollowRelationStatus::tryFrom(trim($result->body)) ?? $status;
+ }
$rel = FollowRelation::create($args[0], $this, $status);
$rel->processNotifications();
return $status;