Skip to content

Commit

Permalink
Update Inbox, improve story attribute collection
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Dec 8, 2023
1 parent d1c297d commit 06bee36
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions app/Util/ActivityPub/Inbox.php
Expand Up @@ -713,8 +713,10 @@ public function handleDeleteActivity()
if(!$status) {
return;
}
if($status->scope && $status->scope != 'direct') {
FeedRemoveRemotePipeline::dispatch($status->id, $status->profile_id)->onQueue('feed');
if($status->scope && in_array($status->scope, ['public', 'unlisted', 'private'])) {
if($status->type && !in_array($status->type, ['story:reaction', 'story:reply', 'reply'])) {
FeedRemoveRemotePipeline::dispatch($status->id, $status->profile_id)->onQueue('feed');
}
}
RemoteStatusDelete::dispatch($status)->onQueue('high');
return;
Expand Down Expand Up @@ -985,9 +987,18 @@ public function handleStoryReactionActivity()
return;
}

$url = $id;

if(str_ends_with($url, '/activity')) {
$url = substr($url, 0, -9);
}

$status = new Status;
$status->profile_id = $actorProfile->id;
$status->type = 'story:reaction';
$status->url = $url;
$status->uri = $url;
$status->object_url = $url;
$status->caption = $text;
$status->rendered = $text;
$status->scope = 'direct';
Expand Down Expand Up @@ -1094,11 +1105,20 @@ public function handleStoryReplyActivity()
return;
}

$url = $id;

if(str_ends_with($url, '/activity')) {
$url = substr($url, 0, -9);
}

$status = new Status;
$status->profile_id = $actorProfile->id;
$status->type = 'story:reply';
$status->caption = $text;
$status->rendered = $text;
$status->url = $url;
$status->uri = $url;
$status->object_url = $url;
$status->scope = 'direct';
$status->visibility = 'direct';
$status->in_reply_to_profile_id = $story->profile_id;
Expand Down

0 comments on commit 06bee36

Please sign in to comment.