From a8c9bd80add5e9b8ca7a3ec8a968338eb55b45ea Mon Sep 17 00:00:00 2001 From: vickydotbat Date: Sat, 11 Jul 2026 20:24:50 +0200 Subject: [PATCH] Port templates to NodeBB 4.14 benchpress escaping NodeBB 4.14 registers a real __escape for template rendering (4.13 used identity), so raw-HTML output must use the double-brace forms: - HTML helpers: {{buildAvatar(...)}}, {{buildCategoryIcon(...)}}, etc. - Pre-rendered HTML fields: {{txEscape(content)}} / {{./descriptionParsed}} - Token-bearing text (nav labels, category names): {{tx(...)}} - emails/partials/post-queue-body.tpl also adopts the 4.14 data shape (notification.category/topic/user/content). Mirrors the harmony 2.2.72 -> 3.0.15 and core 4.13.2 -> 4.14.0 diffs. Co-Authored-By: Claude Fable 5 --- templates/category.tpl | 6 +++--- templates/emails/digest.tpl | 8 ++++---- templates/emails/notification.tpl | 2 +- templates/emails/partials/post-queue-body.tpl | 14 +++++++------- templates/header.tpl | 6 +++--- templates/partials/categories/children.tpl | 2 +- templates/partials/categories/item.tpl | 4 ++-- templates/partials/categories/lastpost.tpl | 4 ++-- .../category/selector-dropdown-content.tpl | 8 ++++---- templates/partials/header/topbar.tpl | 10 +++++----- templates/partials/posts_list_item.tpl | 6 +++--- templates/partials/quick-search-results.tpl | 2 +- templates/partials/search-results.tpl | 2 +- templates/partials/topics_list.tpl | 12 ++++++------ 14 files changed, 43 insertions(+), 43 deletions(-) diff --git a/templates/category.tpl b/templates/category.tpl index 10c27fa..d53c030 100644 --- a/templates/category.tpl +++ b/templates/category.tpl @@ -6,10 +6,10 @@
- {buildCategoryIcon(@value, "60px", "rounded-1")} + {{buildCategoryIcon(@value, "60px", "rounded-1")}}
-

{./name}

+

{{tx(./name)}}

{humanReadableNumber(totalTopicCount)} @@ -33,7 +33,7 @@
{{{ if ./descriptionParsed }}}
- {./descriptionParsed} + {{./descriptionParsed}}
{{{ end }}} {{{ if ./handleFull }}} diff --git a/templates/emails/digest.tpl b/templates/emails/digest.tpl index b9c1a64..19e46be 100644 --- a/templates/emails/digest.tpl +++ b/templates/emails/digest.tpl @@ -34,7 +34,7 @@ {{{ end }}} -

{notifications.bodyShort}

+

{{notifications.bodyShort}}

@@ -73,7 +73,7 @@
  • - +
    {renderDigestAvatar(@value)}{{renderDigestAvatar(@value)}}

    {topTopics.title}

    {topTopics.teaser.user.displayname}

    @@ -108,7 +108,7 @@
  • - +
    {renderDigestAvatar(@value)}{{renderDigestAvatar(@value)}}

    {popularTopics.title}

    {popularTopics.teaser.user.displayname}

    @@ -143,7 +143,7 @@
  • - + diff --git a/templates/emails/partials/post-queue-body.tpl b/templates/emails/partials/post-queue-body.tpl index c95df5d..420e69b 100644 --- a/templates/emails/partials/post-queue-body.tpl +++ b/templates/emails/partials/post-queue-body.tpl @@ -1,18 +1,18 @@

    [[post-queue:category]]

    -

    {category.name}

    +

    {{tx(notification.category.name)}}

    {{{ if topic.tid }}}[[post-queue:topic]]{{{ else }}}[[post-queue:title]]{{{ + >{{{ if notification.topic.tid }}}[[post-queue:topic]]{{{ else }}}[[post-queue:title]]{{{ end }}}

    - {{{ if topic.url }}}{topic.title}{{{ else - }}}{topic.title}{{{ end }}} + {{{ if notification.topic.url }}}{notification.topic.title}{{{ else + }}}{notification.topic.title}{{{ end }}}

    [[post-queue:user]]

    - {{{ if user.url }}}{user.username}{{{ else - }}}{user.username}{{{ end }}} + {{{ if notification.user.url }}}{notification.user.username}{{{ else + }}}{notification.user.username}{{{ end }}}

    -

    {content}

    +

    {{txEscape(notification.content)}}

    diff --git a/templates/header.tpl b/templates/header.tpl index 83fe707..5844f1b 100644 --- a/templates/header.tpl +++ b/templates/header.tpl @@ -1,10 +1,10 @@ - +{browserTitle} - {{{each metaTags}}}{function.buildMetaTag}{{{end}}} + {{{each metaTags}}}{{buildMetaTag(@value)}}{{{end}}} - {{{each linkTags}}}{function.buildLinkTag}{{{end}}} + {{{each linkTags}}}{{buildLinkTag(@value)}}{{{end}}}
    {renderDigestAvatar(@value)}{{renderDigestAvatar(@value)}}

    {recent.title}

    {recent.teaser.user.displayname}

    diff --git a/templates/emails/notification.tpl b/templates/emails/notification.tpl index ea85b3a..af3ca54 100644 --- a/templates/emails/notification.tpl +++ b/templates/emails/notification.tpl @@ -20,7 +20,7 @@

    -{body} +{{txEscape(body)}}