Format content for push notifications - refs BT#15928

ofaj
Angel Fernando Quiroz Campos 6 years ago committed by Nicolas Ducoulombier
parent 0ce058c931
commit eab1c8a7d8
  1. 8
      main/inc/lib/notification.lib.php

@ -491,9 +491,11 @@ class Notification extends Model
return false;
}
$content = str_replace(['<br>', '<br/>', '<br />'], "\n", $content);
$content = strip_tags($content);
$content = html_entity_decode($content, ENT_QUOTES);
$content = explode("\n", $content);
$content = array_map('trim', $content);
$content = array_filter($content);
$content = implode(PHP_EOL, $content);
$gcmRegistrationIds = [];
foreach ($userIds as $userId) {
@ -529,7 +531,7 @@ class Notification extends Model
'title' => $title,
'body' => $content,
],
'collapse_key' => 'Messages',
'collapse_key' => get_lang('Messages'),
'sound' => true,
]);

Loading…
Cancel
Save