fix comments events pandora_enterprise#10631

This commit is contained in:
daniel 2023-04-11 15:43:21 +02:00
parent 57c6788a19
commit eaf71f39ec
1 changed files with 12 additions and 15 deletions

View File

@ -7031,23 +7031,20 @@ function ui_print_comments($comments)
}
}
$last_comment = [];
foreach ($comments_array as $comm) {
// Show the comments more recent first.
if (is_array($comm)) {
$order_utimestamp = array_reduce(
$comm,
function ($carry, $item) {
$carry[$item['utimestamp']] = $item;
return $carry;
}
);
$order_utimestamp = array_reduce(
$comments_array,
function ($carry, $item) {
foreach ($item as $k => $v) {
$carry[$v['utimestamp']] = $v;
}
$key_max_utimestamp = max(array_keys($order_utimestamp));
$last_comment = $order_utimestamp[$key_max_utimestamp];
return $carry;
}
}
);
$key_max_utimestamp = max(array_keys($order_utimestamp));
$last_comment = $order_utimestamp[$key_max_utimestamp];
if (empty($last_comment) === true) {
return '';