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

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/55663/head
Joas Schilling 2025-10-09 11:08:54 +07:00 committed by backportbot[bot]
parent eabb387052
commit fbc07cac31
1 changed files with 4 additions and 0 deletions

@ -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;