mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Update AP Inbox
This commit is contained in:
parent
234f1df097
commit
8a93ed38fa
1 changed files with 10 additions and 3 deletions
|
@ -205,21 +205,27 @@ class Inbox
|
||||||
{
|
{
|
||||||
$actor = $this->actorFirstOrCreate($this->payload['actor']);
|
$actor = $this->actorFirstOrCreate($this->payload['actor']);
|
||||||
$activity = $this->payload['object'];
|
$activity = $this->payload['object'];
|
||||||
|
|
||||||
if(!$actor || $actor->domain == null) {
|
if(!$actor || $actor->domain == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Helpers::validateLocalUrl($activity) == false) {
|
if(Helpers::validateLocalUrl($activity) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$parent = Helpers::statusFirstOrFetch($activity, true);
|
|
||||||
if(!$parent) {
|
$parent = Helpers::statusFetch($activity);
|
||||||
|
|
||||||
|
if(empty($parent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = Status::firstOrCreate([
|
$status = Status::firstOrCreate([
|
||||||
'profile_id' => $actor->id,
|
'profile_id' => $actor->id,
|
||||||
'reblog_of_id' => $parent->id,
|
'reblog_of_id' => $parent->id,
|
||||||
'type' => 'reply'
|
'type' => 'share'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Notification::firstOrCreate([
|
Notification::firstOrCreate([
|
||||||
'profile_id' => $parent->profile->id,
|
'profile_id' => $parent->profile->id,
|
||||||
'actor_id' => $actor->id,
|
'actor_id' => $actor->id,
|
||||||
|
@ -229,6 +235,7 @@ class Inbox
|
||||||
'item_id' => $parent->id,
|
'item_id' => $parent->id,
|
||||||
'item_type' => 'App\Status'
|
'item_type' => 'App\Status'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$parent->reblogs_count = $parent->shares()->count();
|
$parent->reblogs_count = $parent->shares()->count();
|
||||||
$parent->save();
|
$parent->save();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue