fix(comments): Don't throw type error when no itemType or itemId is given

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2025-10-09 11:08:54 +02:00
parent d659cbcd0e
commit d332091105
No known key found for this signature in database
GPG key ID: F72FA5B49FFA96B0

View file

@ -27,6 +27,10 @@ class CommentersSorter implements ISorter {
* @param array $context
*/
public function sort(array &$sortArray, array $context): void {
if (!isset($context['itemType'], $context['itemId'])) {
return;
}
$commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']);
if (count($commenters) === 0) {
return;