fix(activitypub): add conditions for possibly missing actor properties + add user-agent to requests

This commit is contained in:
Yassine Doghri 2022-02-02 10:25:28 +00:00
commit 8fbf948fbb
3 changed files with 49 additions and 15 deletions

View file

@ -108,12 +108,13 @@ class ActorController extends Controller
if ($replyToPost !== null) {
// TODO: strip content from html to retrieve message
// remove all html tags and reconstruct message with mentions?
extract_text_from_html($payload->object->content);
$message = get_message_from_object($payload->object);
$reply = new Post([
'uri' => $payload->object->id,
'actor_id' => $payloadActor->id,
'in_reply_to_id' => $replyToPost->id,
'message' => $payload->object->content,
'message' => $message,
'published_at' => Time::parse($payload->object->published),
]);
}