forked from mirror/pixelfed
Update ActivityPub Inbox
This commit is contained in:
parent
8d3acc0101
commit
2078bb10c9
1 changed files with 46 additions and 6 deletions
|
@ -248,7 +248,28 @@ class Inbox
|
||||||
|
|
||||||
public function handleAcceptActivity()
|
public function handleAcceptActivity()
|
||||||
{
|
{
|
||||||
|
$actor = $this->payload['actor'];
|
||||||
|
$obj = $this->payload['object'];
|
||||||
|
switch ($obj['type']) {
|
||||||
|
case 'Follow':
|
||||||
|
$accept = [
|
||||||
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
|
'id' => $target->permalink().'#accepts/follows/' . $follower->id,
|
||||||
|
'type' => 'Accept',
|
||||||
|
'actor' => $target->permalink(),
|
||||||
|
'object' => [
|
||||||
|
'id' => $actor->permalink('#follows/'.$target->id),
|
||||||
|
'type' => 'Follow',
|
||||||
|
'actor' => $actor->permalink(),
|
||||||
|
'object' => $target->permalink()
|
||||||
|
]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
# code...
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleDeleteActivity()
|
public function handleDeleteActivity()
|
||||||
|
@ -298,11 +319,7 @@ class Inbox
|
||||||
$obj = $this->payload['object'];
|
$obj = $this->payload['object'];
|
||||||
|
|
||||||
switch ($obj['type']) {
|
switch ($obj['type']) {
|
||||||
case 'Like':
|
case 'Accept':
|
||||||
$status = Helpers::statusFirstOrFetch($obj['object']);
|
|
||||||
Like::whereProfileId($profile->id)
|
|
||||||
->whereStatusId($status->id)
|
|
||||||
->forceDelete();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Announce':
|
case 'Announce':
|
||||||
|
@ -318,6 +335,29 @@ class Inbox
|
||||||
->forceDelete();
|
->forceDelete();
|
||||||
$status->forceDelete();
|
$status->forceDelete();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'Block':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Follow':
|
||||||
|
$following = self::actorFirstOrCreate($obj['object']);
|
||||||
|
Follower::whereProfileId($profile->id)
|
||||||
|
->whereFollowingId($following->id)
|
||||||
|
->delete();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Like':
|
||||||
|
$status = Helpers::statusFirstOrFetch($obj['object']);
|
||||||
|
Like::whereProfileId($profile->id)
|
||||||
|
->whereStatusId($status->id)
|
||||||
|
->forceDelete();
|
||||||
|
Notification::whereProfileId($status->profile->id)
|
||||||
|
->whereActorId($profile->id)
|
||||||
|
->whereAction('like')
|
||||||
|
->whereItemId($status->id)
|
||||||
|
->whereItemType('App\Status')
|
||||||
|
->forceDelete();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue