Skip to content

Commit

Permalink
Re-enable rendering HTML in notification list
Browse files Browse the repository at this point in the history
In the 3.1 release, it was possible to render HTML in the template
passed to `mgilet_notification_render()`. Since 3.2, this isn't possible
any more and instead, all HTML is escaped. This change of behavior was
introduced in
#71.
Unfortunately, the PR and commit message are very short on detail,
making it hard to judge if this change was intentional or not. Either
way, it breaks compatibility with existing code and shouldn't be
introduced in a minor release.

This patch changes the behavior back to the 3.1-like behavior.

Specific code that broke by the 3.2 update:

* https://github.com/librecores/librecores-web/blob/451c69cd1693ef8ceafb84cb3c7690be1cd9557d/site/app/Resources/views/base.html.twig#L68
* Template: https://github.com/librecores/librecores-web/blob/master/site/app/Resources/views/notification/notification_list.html.twig
  • Loading branch information
imphil committed Jan 6, 2021
1 parent 8317df5 commit 3f7318e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Twig/NotificationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public function __construct(NotificationManager $notificationManager, TokenStora
public function getFunctions()
{
return array(
new TwigFunction('mgilet_notification_render', [$this, 'render']),
new TwigFunction('mgilet_notification_count', [$this, 'countNotifications']),
new TwigFunction('mgilet_notification_unseen_count', [$this, 'countUnseenNotifications']),
new TwigFunction('mgilet_notification_generate_path', [$this, 'generatePath'])
new TwigFunction('mgilet_notification_render', [$this, 'render'], ['is_safe' => ['html']]),
new TwigFunction('mgilet_notification_count', [$this, 'countNotifications'], ['is_safe' => ['html']]),
new TwigFunction('mgilet_notification_unseen_count', [$this, 'countUnseenNotifications'], ['is_safe' => ['html']]),
new TwigFunction('mgilet_notification_generate_path', [$this, 'generatePath'], ['is_safe' => ['html']])
);
}

Expand Down

0 comments on commit 3f7318e

Please sign in to comment.