mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-03 13:44:13 +00:00
Update AP Inbox
This commit is contained in:
parent
7a72d5aaf2
commit
bce8d642ac
1 changed files with 12 additions and 3 deletions
|
@ -41,7 +41,7 @@ class Inbox
|
||||||
|
|
||||||
public function handleVerb()
|
public function handleVerb()
|
||||||
{
|
{
|
||||||
$verb = $this->payload['type'];
|
$verb = (string) $this->payload['type'];
|
||||||
switch ($verb) {
|
switch ($verb) {
|
||||||
case 'Create':
|
case 'Create':
|
||||||
$this->handleCreateActivity();
|
$this->handleCreateActivity();
|
||||||
|
@ -262,9 +262,9 @@ class Inbox
|
||||||
if(is_string($obj) && Helpers::validateUrl($obj)) {
|
if(is_string($obj) && Helpers::validateUrl($obj)) {
|
||||||
// actor object detected
|
// actor object detected
|
||||||
// todo delete actor
|
// todo delete actor
|
||||||
} else if (is_array($obj) && isset($obj['type']) && $obj['type'] == 'Tombstone') {
|
} else if (Helpers::validateUrl($obj['id']) && is_array($obj) && isset($obj['type']) && $obj['type'] == 'Tombstone') {
|
||||||
// tombstone detected
|
// tombstone detected
|
||||||
$status = Status::whereUri($obj['id'])->firstOrFail();
|
$status = Status::whereLocal(false)->whereUri($obj['id'])->firstOrFail();
|
||||||
$status->forceDelete();
|
$status->forceDelete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,6 +278,9 @@ class Inbox
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$status = Helpers::statusFirstOrFetch($obj);
|
$status = Helpers::statusFirstOrFetch($obj);
|
||||||
|
if(!$status || !$profile) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$like = Like::firstOrCreate([
|
$like = Like::firstOrCreate([
|
||||||
'profile_id' => $profile->id,
|
'profile_id' => $profile->id,
|
||||||
'status_id' => $status->id
|
'status_id' => $status->id
|
||||||
|
@ -313,6 +316,9 @@ class Inbox
|
||||||
|
|
||||||
case 'Follow':
|
case 'Follow':
|
||||||
$following = self::actorFirstOrCreate($obj['object']);
|
$following = self::actorFirstOrCreate($obj['object']);
|
||||||
|
if(!$following) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Follower::whereProfileId($profile->id)
|
Follower::whereProfileId($profile->id)
|
||||||
->whereFollowingId($following->id)
|
->whereFollowingId($following->id)
|
||||||
->delete();
|
->delete();
|
||||||
|
@ -320,6 +326,9 @@ class Inbox
|
||||||
|
|
||||||
case 'Like':
|
case 'Like':
|
||||||
$status = Helpers::statusFirstOrFetch($obj['object']);
|
$status = Helpers::statusFirstOrFetch($obj['object']);
|
||||||
|
if(!$status) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Like::whereProfileId($profile->id)
|
Like::whereProfileId($profile->id)
|
||||||
->whereStatusId($status->id)
|
->whereStatusId($status->id)
|
||||||
->forceDelete();
|
->forceDelete();
|
||||||
|
|
Loading…
Reference in a new issue