From ab02f4a3db1215c9638d116e498d7f3d5c98bf1b Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 1 Sep 2020 05:55:34 +0000 Subject: [PATCH] Avoid notice "Undefined index: activity" --- src/Module/Objects.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Module/Objects.php b/src/Module/Objects.php index 991106def9..bb68adeb3b 100644 --- a/src/Module/Objects.php +++ b/src/Module/Objects.php @@ -91,13 +91,14 @@ class Objects extends BaseModule $data = ['@context' => ActivityPub::CONTEXT]; $data = array_merge($data, $activity['object']); - } elseif (in_array($parameters['activity'], ['Create', 'Announce', 'Update', - 'Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', 'Follow', 'Add', ''])) { + } elseif (empty($parameters['activity']) || in_array($parameters['activity'], + ['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject', + 'TentativeAccept', 'Follow', 'Add'])) { $data = ActivityPub\Transmitter::createActivityFromItem($item['id']); if (empty($data)) { throw new HTTPException\NotFoundException(); } - if (!in_array($parameters['activity'], ['Create', ''])) { + if (!empty($parameters['activity']) && ($parameters['activity'] != 'Create')) { $data['type'] = $parameters['activity']; $data['id'] = str_replace('/Create', '/' . $parameters['activity'], $data['id']); }