Merge pull request #3858 from alchemy-fr/PHRAS-3522-notification-uninterpreted-html

PHRAS-3522 merge Prod - Notification - notifications windows contain uninterpreted HTML (URL)
This commit is contained in:
Nicolas Maillat
2021-09-09 18:53:47 +02:00
committed by GitHub
22 changed files with 33 additions and 23 deletions

View File

@@ -13,5 +13,5 @@ module.exports = {
setupDir: _root + 'tests/setup/node.js', setupDir: _root + 'tests/setup/node.js',
karmaConf: _root + 'config/karma.conf.js', karmaConf: _root + 'config/karma.conf.js',
// change this version when you change JS file for lazy loading // change this version when you change JS file for lazy loading
jsFileVersion: 26 jsFileVersion: 27
}; };

View File

@@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) { /******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ } /******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=26"; /******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=27";
/******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete; /******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() { /******/ function onScriptComplete() {

View File

@@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) { /******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ } /******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=26"; /******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=27";
/******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete; /******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() { /******/ function onScriptComplete() {

View File

@@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) { /******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ } /******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=26"; /******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=27";
/******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete; /******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() { /******/ function onScriptComplete() {

View File

@@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) { /******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ } /******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=26"; /******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=27";
/******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete; /******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() { /******/ function onScriptComplete() {

View File

@@ -19323,6 +19323,9 @@ var notifyLayout = function notifyLayout(services) {
markNotificationRead(event.data['id'], $z); markNotificationRead(event.data['id'], $z);
}); });
date_cont.append($z); date_cont.append($z);
// do not display date in the dialog content beacause it's already grouped by date
(0, _jquery2.default)(".time", $z).hide();
(0, _jquery2.default)(".time-in-dialog", $z).show();
}; };
for (i in notifications) { for (i in notifications) {

View File

@@ -19323,6 +19323,9 @@ var notifyLayout = function notifyLayout(services) {
markNotificationRead(event.data['id'], $z); markNotificationRead(event.data['id'], $z);
}); });
date_cont.append($z); date_cont.append($z);
// do not display date in the dialog content beacause it's already grouped by date
(0, _jquery2.default)(".time", $z).hide();
(0, _jquery2.default)(".time-in-dialog", $z).show();
}; };
for (i in notifications) { for (i in notifications) {

View File

@@ -180,6 +180,9 @@ const notifyLayout = (services) => {
markNotificationRead(event.data['id'], $z); markNotificationRead(event.data['id'], $z);
}); });
date_cont.append($z); date_cont.append($z);
// do not display date in the dialog content beacause it's already grouped by date
$(".time", $z).hide();
$(".time-in-dialog", $z).show();
} }
// handle "show more" button // handle "show more" button

View File

@@ -59,7 +59,7 @@ class PhraseanetExtension extends \Twig_Extension
{ {
return [ return [
// change this version when you change JS file to force the navigation to reload js file // change this version when you change JS file to force the navigation to reload js file
'jsFileVersion' => 26 'jsFileVersion' => 27
]; ];
} }

View File

@@ -37,7 +37,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
} }
$ret = [ $ret = [
'text' => $this->app->trans('%user% s\'est enregistre sur une ou plusieurs %before_link% scollections %after_link%', ['%user%' => $user->getDisplayName(), '%before_link%' => '<a href="/admin/?section=users" target="_blank">', '%after_link%' => '</a>']) 'text' => $this->app->trans('%user% s\'est enregistre sur une ou plusieurs %before_link% scollections %after_link%', ['%user%' => htmlentities($user->getDisplayName()), '%before_link%' => '<a href="/admin/?section=users" target="_blank">', '%after_link%' => '</a>'])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -37,7 +37,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
} }
$ret = [ $ret = [
'text' => $this->app->trans('%user% has published %title%', ['%user%' => $entry->getAuthorName(), '%title%' => '<a href="/lightbox/feeds/entry/' . $entry->getId() . '/" target="_blank">' . $entry->getTitle() . '</a>']) 'text' => $this->app->trans('%user% has published %title%', ['%user%' => htmlentities($entry->getAuthorName()), '%title%' => '<a href="/lightbox/feeds/entry/' . $entry->getId() . '/" target="_blank">' . htmlentities($entry->getTitle()) . '</a>'])
, 'class' => ($unread == 1 ? 'reload_baskets' : '') , 'class' => ($unread == 1 ? 'reload_baskets' : '')
]; ];

View File

@@ -41,7 +41,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
$ret = [ $ret = [
'text' => $this->app->trans('%user% a passe une %opening_link% commande %end_link%', [ 'text' => $this->app->trans('%user% a passe une %opening_link% commande %end_link%', [
'%user%' => $sender, '%user%' => htmlentities($sender),
'%opening_link%' => '<a href="#" class="order-notif" data-id="'.$order_id.'" title="'.$this->app->trans('Orders manager').'">', '%opening_link%' => '<a href="#" class="order-notif" data-id="'.$order_id.'" title="'.$this->app->trans('Orders manager').'">',
'%end_link%' => '</a>',]) '%end_link%' => '</a>',])
, 'class' => '' , 'class' => ''

View File

@@ -63,9 +63,9 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
} }
$ret = [ $ret = [
'text' => $this->app->trans('%user% vous a delivre %quantity% document(s) pour votre commande %title%', ['%user%' => $sender, '%quantity%' => $n, '%title%' => '<a href="/lightbox/compare/' 'text' => $this->app->trans('%user% vous a delivre %quantity% document(s) pour votre commande %title%', ['%user%' => htmlentities($sender), '%quantity%' => $n, '%title%' => '<a href="/lightbox/compare/'
. $ssel_id . '/" target="_blank">' . $ssel_id . '/" target="_blank">'
. $basket->getName() . '</a>']), . htmlentities($basket->getName()) . '</a>']),
'class' => '' 'class' => ''
]; ];

View File

@@ -39,7 +39,7 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac
$sender = $user->getDisplayName(); $sender = $user->getDisplayName();
$ret = [ $ret = [
'text' => $this->app->trans('%user% a refuse la livraison de %quantity% document(s) pour votre commande', ['%user%' => $sender, '%quantity%' => $n]) 'text' => $this->app->trans('%user% a refuse la livraison de %quantity% document(s) pour votre commande', ['%user%' => htmlentities($sender), '%quantity%' => $n])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -39,7 +39,7 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
$sender = $user->getDisplayName(); $sender = $user->getDisplayName();
$ret = [ $ret = [
'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', ['%user%' => $sender, '%before_link%' => '<a href="#" 'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', ['%user%' => htmlentities($sender), '%before_link%' => '<a href="#"
data-kind="BASK" data-kind="BASK"
data-position="1" data-position="1"
data-id="'. $data['ssel_id'] . '" data-id="'. $data['ssel_id'] . '"

View File

@@ -39,7 +39,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
$sender = $user->getDisplayName(); $sender = $user->getDisplayName();
$ret = [ $ret = [
'text' => $this->app->trans('%user% demande votre approbation sur une ou plusieurs %before_link% collections %after_link%', ['%user%' => $sender, '%before_link%' => '<a href="' . $this->app->url('admin', ['section' => 'registrations']) . '" target="_blank">', '%after_link%' => '</a>']) 'text' => $this->app->trans('%user% demande votre approbation sur une ou plusieurs %before_link% collections %after_link%', ['%user%' => htmlentities($sender), '%before_link%' => '<a href="' . $this->app->url('admin', ['section' => 'registrations']) . '" target="_blank">', '%after_link%' => '</a>'])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -41,7 +41,7 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
$filename = $data['filename']; $filename = $data['filename'];
$text = $this->app->trans('The document %name% has been quarantined', ['%name%' => $filename]); $text = $this->app->trans('The document %name% has been quarantined', ['%name%' => htmlentities($filename)]);
if ($reasons) { if ($reasons) {
$text .= ' ' . $this->app->trans('for the following reasons : %reasons%', ['%reasons%' => implode(', ', $reasons)]); $text .= ' ' . $this->app->trans('for the following reasons : %reasons%', ['%reasons%' => implode(', ', $reasons)]);

View File

@@ -56,11 +56,11 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
$bask_link = '<a href="' $bask_link = '<a href="'
. $this->app->url('lightbox_validation', ['basket' => $ssel_id]) . $this->app->url('lightbox_validation', ['basket' => $ssel_id])
. '" target="_blank">' . '" target="_blank">'
. $basket_name . '</a>'; . htmlentities($basket_name) . '</a>';
$ret = [ $ret = [
'text' => $this->app->trans('%user% vous demande de valider %title%', [ 'text' => $this->app->trans('%user% vous demande de valider %title%', [
'%user%' => $sender, '%user%' => htmlentities($sender),
'%title%' => $bask_link, '%title%' => $bask_link,
]) ])
, 'class' => ($unread == 1 ? 'reload_baskets' : '') , 'class' => ($unread == 1 ? 'reload_baskets' : '')

View File

@@ -62,9 +62,9 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
} }
$ret = [ $ret = [
'text' => $this->app->trans('%user% a envoye son rapport de validation de %title%', ['%user%' => $sender, '%title%' => '<a href="/lightbox/validate/' 'text' => $this->app->trans('%user% a envoye son rapport de validation de %title%', ['%user%' => htmlentities($sender), '%title%' => '<a href="/lightbox/validate/'
. $ssel_id . '/" target="_blank">' . $ssel_id . '/" target="_blank">'
. $basket->getName() . '</a>']), . htmlentities($basket->getName()) . '</a>']),
'class' => '' 'class' => ''
]; ];

View File

@@ -63,7 +63,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
. $basket_name . '</a>'; . $basket_name . '</a>';
$ret = [ $ret = [
'text' => $this->app->trans('Rappel : Il vous reste %timeLeft% pour valider %title% de %user%', ['%timeLeft%' => $timeLeft, '%title%' => $bask_link, '%user%' => $sender]) 'text' => $this->app->trans('Rappel : Il vous reste %timeLeft% pour valider %title% de %user%', ['%timeLeft%' => $timeLeft, '%title%' => $bask_link, '%user%' => htmlentities($sender)])
, 'class' => ($unread == 1 ? 'reload_baskets' : '') , 'class' => ($unread == 1 ? 'reload_baskets' : '')
]; ];

View File

@@ -47,7 +47,7 @@
} }
a { a {
color: #414141; color: #08c;
} }
} }
@@ -62,7 +62,7 @@
} }
a { a {
color: #999999; color: #08c;
} }
} }

View File

@@ -6,8 +6,9 @@
<img src="{{notification['icon']}}" style="vertical-align:middle;width:16px;margin:2px;" /> <img src="{{notification['icon']}}" style="vertical-align:middle;width:16px;margin:2px;" />
</td> </td>
<td class="{{notification['class']}}"> <td class="{{notification['class']}}">
{{notification['text'] | e | raw}} {{notification['text'] | raw}}
<span class="time">{{notification['created_on']}}</span> <span class="time">{{notification['created_on']}}</span>
<span class="time-in-dialog" style="color: #666666;display: none;" >{{notification['time']}}</span>
</td> </td>
<td style="width:25px; vertical-align: bottom;"> <td style="width:25px; vertical-align: bottom;">
<span class="icon_read" title="{{ 'notification::read:tooltip' | trans }}"></span> <span class="icon_read" title="{{ 'notification::read:tooltip' | trans }}"></span>