mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update FollowerController, send Undo Follow
This commit is contained in:
parent
43073bd226
commit
37289f7935
1 changed files with 27 additions and 0 deletions
|
@ -86,6 +86,9 @@ class FollowerController extends Controller
|
||||||
FollowPipeline::dispatch($follower);
|
FollowPipeline::dispatch($follower);
|
||||||
} else {
|
} else {
|
||||||
$follower = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->firstOrFail();
|
$follower = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->firstOrFail();
|
||||||
|
if($remote == true) {
|
||||||
|
$this->sendUndoFollow($user, $target);
|
||||||
|
}
|
||||||
$follower->delete();
|
$follower->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,4 +118,28 @@ class FollowerController extends Controller
|
||||||
|
|
||||||
Helpers::sendSignedObject($user, $inbox, $payload);
|
Helpers::sendSignedObject($user, $inbox, $payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function sendUndoFollow($user, $target)
|
||||||
|
{
|
||||||
|
if($target->domain == null || $user->domain != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
|
'id' => $user->permalink('#follow/'.$target->id.'/undo'),
|
||||||
|
'type' => 'Undo',
|
||||||
|
'actor' => $user->permalink(),
|
||||||
|
'object' => [
|
||||||
|
'id' => $user->permalink('#follows/'.$target->id),
|
||||||
|
'actor' => $user->permalink(),
|
||||||
|
'object' => $target->permalink(),
|
||||||
|
'type' => 'Follow'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$inbox = $target->sharedInbox ?? $target->inbox_url;
|
||||||
|
|
||||||
|
Helpers::sendSignedObject($user, $inbox, $payload);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue