Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Bump handlebars 4.3.1 -> 4.5.3 (#77134)

Timothy S. Deand9ea8755452e
diff --git a/bin/build/resources/overrides.edn b/bin/build/resources/overrides.edn
index 38887b30863..16c8429ee4d 100644
--- a/bin/build/resources/overrides.edn
+++ b/bin/build/resources/overrides.edn
@@ -4,6 +4,7 @@
"com.google.cloud" {:resource "apache2_0.txt"}
"com.google.cloud.sql" {:resource "apache2_0.txt"}
"com.google.code.gson" {:resource "apache2_0.txt"}
+ "com.github.jknack" {:resource "apache2_0.txt"}
"com.google.guava" {:resource "apache2_0.txt"}
"com.google.http-client" {:resource "apache2_0.txt"}
"com.google.protobuf" {:resource "apache2_0.txt"}
diff --git a/deps.edn b/deps.edn
index 4f358b15c36..0e91af1ddfb 100644
--- a/deps.edn
+++ b/deps.edn
@@ -38,8 +38,7 @@
; Detect the charset in uploaded CSV files
com.github.albfernandez/juniversalchardet {:mvn/version "2.5.0"}
com.github.blagerweij/liquibase-sessionlock {:mvn/version "1.6.9"} ; session lock for liquibase migrations
- com.github.jknack/handlebars ^:antq/exclude ; 4.4.0 requires java 17+
- {:mvn/version "4.3.1"} ; templating engine
+ com.github.jknack/handlebars {:mvn/version "4.5.3"} ; templating engine
com.github.oliyh/martian-clj-http {:mvn/version "0.2.1"} ; openapi client
com.github.seancorfield/honeysql {:mvn/version "2.7.1350"} ; Honey SQL 2. SQL generation from Clojure data maps
com.github.seancorfield/next.jdbc {:mvn/version "1.3.1070"} ; Talk to JDBC DBs
diff --git a/enterprise/backend/src/metabase_enterprise/security_center/notification.clj b/enterprise/backend/src/metabase_enterprise/security_center/notification.clj
index c9e2fc537d1..221525fb88b 100644
--- a/enterprise/backend/src/metabase_enterprise/security_center/notification.clj
+++ b/enterprise/backend/src/metabase_enterprise/security_center/notification.clj
@@ -36,7 +36,7 @@
{:channel_type :channel/email
:details {:type "email/handlebars-resource"
:subject "[{{payload.custom.severity_label}}] Security Advisory: {{payload.event_info.object.title}}"
- :path "metabase/channel/email/security_advisory.hbs"
+ :path "security_advisory"
:recipient-type "bcc"}})
(defn- sends-to-all-admins?
diff --git a/src/metabase/channel/email/_footer.hbs b/src/metabase/channel/email/_footer.hbs
index 342301e4dac..ef5570bb811 100644
--- a/src/metabase/channel/email/_footer.hbs
+++ b/src/metabase/channel/email/_footer.hbs
@@ -1,7 +1,7 @@
</div>
{{#if logoFooter}}
<div style="padding-bottom: 2em; padding-top: 1em; text-align: center;">
- {{> metabase/channel/email/_logo.hbs }}
+ {{> _logo }}
</div>
{{/if}}
</body>
diff --git a/src/metabase/channel/email/_header.hbs b/src/metabase/channel/email/_header.hbs
index ff77b605b42..e1840944dcd 100644
--- a/src/metabase/channel/email/_header.hbs
+++ b/src/metabase/channel/email/_header.hbs
@@ -47,7 +47,7 @@
<body class="{{emailType}}" style="font-family: 'Lato', 'Helvetica Neue', Helvetica, sans-serif; padding: 1em;">
{{#if logoHeader}}
<div style="padding-bottom: 2em; padding-top: 1em; text-align: center;">
- {{> metabase/channel/email/_logo.hbs }}
+ {{> _logo }}
</div>
{{/if}}
<div class="container" style="margin: 0; padding: 0 0 2em 0; max-width: 100%; font-size: 16px; line-height: 24px; color: #616D75;">
diff --git a/src/metabase/channel/email/broken_subscription_notification.hbs b/src/metabase/channel/email/broken_subscription_notification.hbs
index fccdadd210f..eb779097162 100644
--- a/src/metabase/channel/email/broken_subscription_notification.hbs
+++ b/src/metabase/channel/email/broken_subscription_notification.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<div class="card-container">
<h2
style="margin: 0; padding: 0; font-weight: 700; font-size: 1.5em; color: {{colorTextDark}}; line-height: 1.5em;"
@@ -80,4 +80,4 @@
></div>
{{/unless}}
</div>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/card_notification_archived.hbs b/src/metabase/channel/email/card_notification_archived.hbs
index f92a68446f8..ea004255654 100644
--- a/src/metabase/channel/email/card_notification_archived.hbs
+++ b/src/metabase/channel/email/card_notification_archived.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<p>Alerts about {{card.name}} (#{{card.id}}) have stopped because the question was archived by {{actor.first_name}} {{actor.last_name}}.</p>
{{#unless disable_links}}<p>If you want to restore the alert, go to the <a href="{{{trash-url}}}">trash</a>, restore the question and re-create the alert.</p>{{/unless}}
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/card_notification_changed_stopped.hbs b/src/metabase/channel/email/card_notification_changed_stopped.hbs
index e98ced24626..9887f9b530c 100644
--- a/src/metabase/channel/email/card_notification_changed_stopped.hbs
+++ b/src/metabase/channel/email/card_notification_changed_stopped.hbs
@@ -1,3 +1,3 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<p>Alerts about <a {{#unless disable_links}}href="{{{card-url card.id}}}"{{/unless}}>{{card.name}}</a> have stopped because the question was edited by {{actor.first_name}} {{actor.last_name}}.</p>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/comment_created.hbs b/src/metabase/channel/email/comment_created.hbs
index d0ad2880fb7..cfd1aad360f 100644
--- a/src/metabase/channel/email/comment_created.hbs
+++ b/src/metabase/channel/email/comment_created.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_dashsub_alert_header.hbs }}
+{{> _dashsub_alert_header }}
<body style="padding: 0px; margin: 0px">
<table class="background" width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #F9F9F9; padding: 48px; table-layout: fixed;">
<tr>
diff --git a/src/metabase/channel/email/creator_sentiment_email.hbs b/src/metabase/channel/email/creator_sentiment_email.hbs
index 904fa00ff66..825377cbc77 100644
--- a/src/metabase/channel/email/creator_sentiment_email.hbs
+++ b/src/metabase/channel/email/creator_sentiment_email.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<div class="card-container" style="color: {{colorTextMedium}};">
{{#if self-hosted}}
<p style="font-weight: 500; font-size: 0.875em; line-height: 1.375em; color: {{colorTextMedium}};">
@@ -35,4 +35,4 @@
- The Metabase Product Team
</p>
</div>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/dashboard_subscription.hbs b/src/metabase/channel/email/dashboard_subscription.hbs
index 60309e3fcec..20b05987498 100644
--- a/src/metabase/channel/email/dashboard_subscription.hbs
+++ b/src/metabase/channel/email/dashboard_subscription.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_dashsub_alert_header.hbs }}
+{{> _dashsub_alert_header }}
<body style="padding: 0px">
<table class="background" width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #F9F9F9; padding: 20px; table-layout: fixed;">
<tr>
diff --git a/src/metabase/channel/email/follow_up_email.hbs b/src/metabase/channel/email/follow_up_email.hbs
index 1282add3d00..eb8baf60bb5 100644
--- a/src/metabase/channel/email/follow_up_email.hbs
+++ b/src/metabase/channel/email/follow_up_email.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<div style="padding: 2em 4em; border: 1px solid #dddddd; border-radius: 2px; background-color: white; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); text-align: center;">
<div style="padding-bottom: 1em;">
<h2 style="font-weight: normal; color: #4C545B;line-height: 1.65rem;">{{heading}}</h2>
@@ -17,4 +17,4 @@
This email was sent from your Metabase and only ever happens once, so feel free to ignore it and you won’t be bugged again.
</p>
</div>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/login_from_new_device.hbs b/src/metabase/channel/email/login_from_new_device.hbs
index 591035a9384..ea16daf9804 100644
--- a/src/metabase/channel/email/login_from_new_device.hbs
+++ b/src/metabase/channel/email/login_from_new_device.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_dashsub_alert_header.hbs }}
+{{> _dashsub_alert_header }}
<body style="padding: 0px; margin: 0px">
<table class="background" width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #F9F9F9; padding: 48px; table-layout: fixed;">
<tr>
diff --git a/src/metabase/channel/email/messages.clj b/src/metabase/channel/email/messages.clj
index 308e53df736..6cbdee632cc 100644
--- a/src/metabase/channel/email/messages.clj
+++ b/src/metabase/channel/email/messages.clj
@@ -135,7 +135,7 @@
(trs "{0} accepted their {1} invite" (:common_name new-user) (app-name-trs))))
:recipients recipients
:message-type :html
- :message (channel.template/render "metabase/channel/email/user_joined_notification.hbs"
+ :message (channel.template/render "user_joined_notification"
{:context {:application_name (appearance/application-name)
:application_color (channel.render/primary-color)
:application_logo_url (logo-url)
@@ -155,7 +155,7 @@
((some-fn string? nil?) password-reset-url)]}
(let [google-sso? (= :google sso-source)
message-body (channel.template/render
- "metabase/channel/email/password_reset.hbs"
+ "password_reset"
(merge (common-context)
{:emailType "password_reset"
:google google-sso?
@@ -190,7 +190,7 @@
:device (:device_description login-history)
:location (:location login-history)
:timestamp timestamp}
- message-body (channel.template/render "metabase/channel/email/login_from_new_device.hbs"
+ message-body (channel.template/render "login_from_new_device"
context)]
(send-email-with-logo!
{:subject (trs "We''ve Noticed a New {0} Login, {1}" (app-name-trs) username)
@@ -256,7 +256,7 @@
:card-url (urls/card-url (:id card))
:collection-url (urls/collection-url (:id collection))
:caching-log-details-url (urls/tools-caching-details-url (:id persisted-info))})}
- message-body (channel.template/render "metabase/channel/email/persisted-model-error.hbs"
+ message-body (channel.template/render "persisted-model-error"
(merge (common-context) context))]
(when (seq emails)
(email/send-message!
@@ -278,7 +278,7 @@
email-msg {:subject (trs "[{0}] Tell us how things are going." (app-name-trs))
:recipients [email]
:message-type :html
- :message (channel.template/render "metabase/channel/email/follow_up_email.hbs" context)}]
+ :message (channel.template/render "follow_up_email" context)}]
(send-email-with-logo! email-msg)))
(defn send-creator-sentiment-email!
@@ -302,7 +302,7 @@
message {:subject "Metabase would love your take on something"
:recipients [email]
:message-type :html
- :message (channel.template/render "metabase/channel/email/creator_sentiment_email.hbs" context)}]
+ :message (channel.template/render "creator_sentiment_email" context)}]
(send-email-with-logo! message)))
(defn generate-pulse-unsubscribe-hash
@@ -336,16 +336,16 @@
:rows))
(defn- send-email-sync!
- ([recipients subject template-path template-context]
- (send-email-sync! recipients subject template-path template-context false))
- ([recipients subject template-path template-context bcc?]
+ ([recipients subject template-name template-context]
+ (send-email-sync! recipients subject template-name template-context false))
+ ([recipients subject template-name template-context bcc?]
(when (seq recipients)
(try
(email/send-email-retrying!
{:recipients recipients
:message-type :html
:subject subject
- :message (channel.template/render template-path template-context)
+ :message (channel.template/render template-name template-context)
:bcc? bcc?})
(catch Exception e
(log/errorf e "Failed to send message to '%s' with subject '%s'" (str/join ", " recipients) subject))))))
@@ -355,15 +355,12 @@
[& args]
(future (apply send-email-sync! args)))
-(defn- template-path [template-name]
- (str "metabase/channel/email/" template-name ".hbs"))
-
-;; Paths to the templates for all of the alerts emails
-(def ^:private you-unsubscribed-template (template-path "notification_card_unsubscribed"))
-(def ^:private removed-template (template-path "notification_card_you_were_removed"))
-(def ^:private added-template (template-path "notification_card_you_were_added"))
-(def ^:private changed-stopped-template (template-path "card_notification_changed_stopped"))
-(def ^:private archived-template (template-path "card_notification_archived"))
+;; Template names for the alert emails
+(def ^:private you-unsubscribed-template "notification_card_unsubscribed")
+(def ^:private removed-template "notification_card_you_were_removed")
+(def ^:private added-template "notification_card_you_were_added")
+(def ^:private changed-stopped-template "card_notification_changed_stopped")
+(def ^:private archived-template "card_notification_archived")
(defn- username
[user]
@@ -425,7 +422,7 @@
:recipients (distinct (map :email [pulse-creator dashboard-creator]))
:message-type :html
:message (channel.template/render
- "metabase/channel/email/broken_subscription_notification.hbs"
+ "broken_subscription_notification"
(merge context
{:dashboardName dashboard-name
:badParameters (map
diff --git a/src/metabase/channel/email/new_user_invite.hbs b/src/metabase/channel/email/new_user_invite.hbs
index 30462757bb2..2551caea920 100644
--- a/src/metabase/channel/email/new_user_invite.hbs
+++ b/src/metabase/channel/email/new_user_invite.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
{{#with payload.event_info.details.invitor as |invitor|}}
<div style="padding-top: 40px; padding-left: 16px; padding-bottom: 96px; padding-right: 16px; box-sizing: border-box; width: 100%; max-width: 600px; background-color: #FFFFFF; border-radius: 24px; border: 1px solid #dcdfe0; margin-top: 32px; margin-left: auto; margin-right: auto;">
<div style="margin-bottom: 32px; text-align: center; padding-top: 5px; box-sizing: border-box; padding-bottom: 5px;">
diff --git a/src/metabase/channel/email/notification_card.hbs b/src/metabase/channel/email/notification_card.hbs
index 0bb7c512188..afbea92cf27 100644
--- a/src/metabase/channel/email/notification_card.hbs
+++ b/src/metabase/channel/email/notification_card.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_dashsub_alert_header.hbs }}
+{{> _dashsub_alert_header }}
<body style="padding: 0px">
<table class="background" width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #F9F9F9; padding: 20px; table-layout: fixed;">
<tr>
diff --git a/src/metabase/channel/email/notification_card_new_confirmation.hbs b/src/metabase/channel/email/notification_card_new_confirmation.hbs
index 7b9f90c9348..693d1c069ae 100644
--- a/src/metabase/channel/email/notification_card_new_confirmation.hbs
+++ b/src/metabase/channel/email/notification_card_new_confirmation.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<p>This is just a confirmation that your alert about <a {{#unless payload.event_info.object.payload.disable_links}}href="{{{card-url payload.event_info.object.payload.card_id}}}"{{/unless}}>{{payload.event_info.object.payload.card.name}}</a> has been set up.</p>
- <p>This alert will be sent {{> metabase/channel/email/_notification_card_condition.hbs send_condition=payload.event_info.object.payload.send_condition}}.</p>
-{{> metabase/channel/email/_footer.hbs}}
+ <p>This alert will be sent {{> _notification_card_condition send_condition=payload.event_info.object.payload.send_condition}}.</p>
+{{> _footer}}
diff --git a/src/metabase/channel/email/notification_card_unsubscribed.hbs b/src/metabase/channel/email/notification_card_unsubscribed.hbs
index d9a01648c6e..6126aa5dcc2 100644
--- a/src/metabase/channel/email/notification_card_unsubscribed.hbs
+++ b/src/metabase/channel/email/notification_card_unsubscribed.hbs
@@ -1,3 +1,3 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<p>You’re no longer receiving alerts about <a href="{{{card-url payload.card_id}}}">{{payload.card.name}}</a>.</p>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/notification_card_you_were_added.hbs b/src/metabase/channel/email/notification_card_you_were_added.hbs
index a421d16662e..aa3f10de8d4 100644
--- a/src/metabase/channel/email/notification_card_you_were_added.hbs
+++ b/src/metabase/channel/email/notification_card_you_were_added.hbs
@@ -1,5 +1,5 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<p>You're now getting alerts about <a href="{{{card-url payload.card_id}}}">{{payload.card.name}}</a>.</p>
- <p>We'll send you an email {{> metabase/channel/email/_notification_card_condition.hbs send_condition=payload.send_condition}}.</p>
+ <p>We'll send you an email {{> _notification_card_condition send_condition=payload.send_condition}}.</p>
<p>If you don't want to receive these alerts, you can <a href="{{{card-url payload.card_id}}}">go to this question</a> and unsubscribe by clicking the sharing icon on the top right.</p>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/notification_card_you_were_removed.hbs b/src/metabase/channel/email/notification_card_you_were_removed.hbs
index 26eb52b2b10..460794e0016 100644
--- a/src/metabase/channel/email/notification_card_you_were_removed.hbs
+++ b/src/metabase/channel/email/notification_card_you_were_removed.hbs
@@ -1,3 +1,3 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<p>Just letting you know that {{actor_name}} unsubscribed you from alerts about <a {{#unless payload.disable_links}}href="{{{card-url payload.card_id}}}"{{/unless}}>{{payload.card.name}}</a>.</p>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/password_reset.hbs b/src/metabase/channel/email/password_reset.hbs
index ab4d354189c..53a8b422ea2 100644
--- a/src/metabase/channel/email/password_reset.hbs
+++ b/src/metabase/channel/email/password_reset.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<div>
{{#if google}}
<p>You're using Google to log in to {{applicationName}}, so you don't have a password. You can log in to {{applicationName}} by clicking "Sign in with Google"</p>
@@ -25,4 +25,4 @@
{{/if}}
{{/if}}
</div>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/persisted-model-error.hbs b/src/metabase/channel/email/persisted-model-error.hbs
index e8ebba7244a..4aa08bb66ca 100644
--- a/src/metabase/channel/email/persisted-model-error.hbs
+++ b/src/metabase/channel/email/persisted-model-error.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<div class="card-container">
<h2
style="margin: 0; padding: 0; font-weight: 700; font-size: 1.5em; color: {{colorTextDark}}; line-height: 1.5em;"
@@ -107,4 +107,4 @@
<a href="https://www.metabase.com/docs/latest/troubleshooting-guide/datawarehouse.html" style="color: #A4ADCA;">troubleshooting</a> guides.
</p>
</div>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/security_advisory.hbs b/src/metabase/channel/email/security_advisory.hbs
index effbacb7f44..2a1da548b5f 100644
--- a/src/metabase/channel/email/security_advisory.hbs
+++ b/src/metabase/channel/email/security_advisory.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<div style="padding-bottom: 2em; padding-top: 1em; text-align: center;">
<img style="max-height: 40px; max-width: 100%;" src="{{context.application_logo_url}}" alt="{{context.application_name}} logo"/>
</div>
@@ -18,4 +18,4 @@
</div>
<a style="{{context.style.button}}" href="{{payload.custom.security_center_url}}">Go to Security Center</a>
</div>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/slack_token_error.hbs b/src/metabase/channel/email/slack_token_error.hbs
index 43bfae87023..ad3959472b0 100644
--- a/src/metabase/channel/email/slack_token_error.hbs
+++ b/src/metabase/channel/email/slack_token_error.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<div style="padding-bottom: 2em; padding-top: 1em; text-align: center;">
<img style="max-height: 40px; max-width: 100%;" src="{{context.application_logo_url}}" alt="{{context.application_name}} logo"/>
</div>
@@ -9,4 +9,4 @@
</div>
<a style="{{context.style.button}}" href="{{context.site_url}}/admin/settings/slack">Go to settings</a>
</div>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/email/support_access_grant.hbs b/src/metabase/channel/email/support_access_grant.hbs
index 2d7332a96dc..a99992b7437 100644
--- a/src/metabase/channel/email/support_access_grant.hbs
+++ b/src/metabase/channel/email/support_access_grant.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_dashsub_alert_header.hbs }}
+{{> _dashsub_alert_header }}
<body style="padding: 0px; margin: 0px">
<table class="background" width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #F9F9F9; padding: 48px; table-layout: fixed;">
<tr>
diff --git a/src/metabase/channel/email/transform_failed.hbs b/src/metabase/channel/email/transform_failed.hbs
index 1a24a5ae1d8..130d020ea86 100644
--- a/src/metabase/channel/email/transform_failed.hbs
+++ b/src/metabase/channel/email/transform_failed.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_dashsub_alert_header.hbs }}
+{{> _dashsub_alert_header }}
<body style="padding: 0px; margin: 0px">
<table class="background" width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #F9F9F9; padding: 48px; table-layout: fixed;">
<tr>
diff --git a/src/metabase/channel/email/transform_failure_digest.hbs b/src/metabase/channel/email/transform_failure_digest.hbs
index e6faf77fd0d..ad9fb97e96e 100644
--- a/src/metabase/channel/email/transform_failure_digest.hbs
+++ b/src/metabase/channel/email/transform_failure_digest.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_dashsub_alert_header.hbs }}
+{{> _dashsub_alert_header }}
<body style="padding: 0px; margin: 0px">
<table class="background" width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #F9F9F9; padding: 48px; table-layout: fixed;">
<tr>
diff --git a/src/metabase/channel/email/user_joined_notification.hbs b/src/metabase/channel/email/user_joined_notification.hbs
index 6e0623c4d35..467700b02d0 100644
--- a/src/metabase/channel/email/user_joined_notification.hbs
+++ b/src/metabase/channel/email/user_joined_notification.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_dashsub_alert_header.hbs }}
+{{> _dashsub_alert_header }}
<body style="padding: 0px; margin: 0px">
<table class="background" width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #F9F9F9; padding: 48px; table-layout: fixed;">
<tr>
diff --git a/src/metabase/channel/email/warn_deprecate_pulse.hbs b/src/metabase/channel/email/warn_deprecate_pulse.hbs
index f7797dff57b..8acde6c08e0 100644
--- a/src/metabase/channel/email/warn_deprecate_pulse.hbs
+++ b/src/metabase/channel/email/warn_deprecate_pulse.hbs
@@ -1,4 +1,4 @@
-{{> metabase/channel/email/_header.hbs }}
+{{> _header }}
<p>Hi {{userName}},</p>
<p>We deprecated Pulses in Metabase 0.38, two years ago.</p>
<p>Now the time has come to remove them.</p>
@@ -13,4 +13,4 @@
<p>This message was sent to all Admins of <a href="{{instanceURL}}">{{instanceURL}}</a>.</p>
<p>Onward!</p>
<p>- The Metabase Team</p>
-{{> metabase/channel/email/_footer.hbs }}
+{{> _footer }}
diff --git a/src/metabase/channel/impl/email.clj b/src/metabase/channel/impl/email.clj
index 7eb30355ff2..5ef86aa6acd 100644
--- a/src/metabase/channel/impl/email.clj
+++ b/src/metabase/channel/impl/email.clj
@@ -220,11 +220,11 @@
{:notification/dashboard {:channel_type :channel/email
:details {:type :email/handlebars-resource
:subject "{{payload.dashboard.name}}"
- :path "metabase/channel/email/dashboard_subscription.hbs"}}
+ :path "dashboard_subscription"}}
:notification/card {:channel_type :channel/email
:details {:type :email/handlebars-resource
:subject "{{computed.subject}}"
- :path "metabase/channel/email/notification_card.hbs"}}})
+ :path "notification_card"}}})
;; ------------------------------------------------------------------------------------------------;;
;; Notification Card ;;
diff --git a/src/metabase/channel/models/channel.clj b/src/metabase/channel/models/channel.clj
index 3332adfb732..52ecb6013b5 100644
--- a/src/metabase/channel/models/channel.clj
+++ b/src/metabase/channel/models/channel.clj
@@ -112,7 +112,7 @@
[:path [:and
string?
[:fn {:error/message "invalid template path"}
- handlebars/valid-template-path?]]]]]
+ handlebars/valid-template-name?]]]]]
[:email/handlebars-text
[:map
[:body string?]]]]])
diff --git a/src/metabase/channel/template/handlebars.clj b/src/metabase/channel/template/handlebars.clj
index 07517f7e9fe..c7d3c926559 100644
--- a/src/metabase/channel/template/handlebars.clj
+++ b/src/metabase/channel/template/handlebars.clj
@@ -12,7 +12,7 @@
(com.github.jknack.handlebars.cache ConcurrentMapTemplateCache)
(com.github.jknack.handlebars.context MapValueResolver)
(com.github.jknack.handlebars.io
- ClassPathTemplateLoader)))
+ ClassPathTemplateLoader CompositeTemplateLoader TemplateLoader)))
(set! *warn-on-reflection* true)
@@ -24,10 +24,23 @@
(when reload?
(.setReload (.getCache <>) true))))
+(def ^:private template-dirs
+ "Classpath dirs holding `.hbs` templates. A bare template name resolves
+ against these dirs in order."
+ ["/metabase/channel/email/"
+ "/notification/channel_template/"])
+
(defn classpath-loader
- "Create a ClassPathTemplateLoader with a prefix and postfix."
- [prefix postfix]
- (ClassPathTemplateLoader. prefix postfix))
+ "Create a `ClassPathTemplateLoader` with a prefix and suffix."
+ ^TemplateLoader [prefix suffix]
+ (ClassPathTemplateLoader. prefix suffix))
+
+(defn default-loader
+ "A `CompositeTemplateLoader` over [[template-dirs]]: on a name it tries each
+ dir's loader in order and returns the first hit, throwing if all miss."
+ ^TemplateLoader []
+ (CompositeTemplateLoader.
+ (into-array TemplateLoader (map #(classpath-loader % ".hbs") template-dirs))))
(defn- wrap-context
[context]
@@ -45,7 +58,7 @@
(.build)))
(def ^:private default-hbs
- (delay (u/prog1 (registry (classpath-loader "/" "") :reload? true)
+ (delay (u/prog1 (registry (default-loader) :reload? true)
(handlebars-helper/register-helpers <> handlebars-helper/default-helpers))))
(when config/is-dev?
@@ -57,32 +70,28 @@
(catch Exception e
(log/warn e "Error reloading default helpers"))))))
-(def ^:private allowed-template-prefixes
- "Set of allowed directory prefixes for template paths."
- #{"metabase/channel/email/"
- "notification/channel_template/"})
-
-(defn valid-template-path?
- "Returns true if the template path is safe: ends with .hbs, does not contain ..,
- and starts with one of the allowed prefixes."
- [^String path]
+(defn valid-template-name?
+ "True iff `template-name` is a well-formed relative template name: non-blank,
+ no leading `/`, no `..`, and no `.hbs` suffix (the loader appends it)."
+ [^String template-name]
(boolean
- (and (str/ends-with? path ".hbs")
- (not (str/includes? path ".."))
- (some #(str/starts-with? path %) allowed-template-prefixes))))
+ (and (not (str/blank? template-name))
+ (not (str/starts-with? template-name "/"))
+ (not (str/includes? template-name ".."))
+ (not (str/ends-with? template-name ".hbs")))))
-(defn- validate-template-path!
- "Validate that a template path is safe, throw if not."
- [^String path]
- (when-not (valid-template-path? path)
- (throw (ex-info "invalid template path" {:path path}))))
+(defn- validate-template-name!
+ "Validate that a template name is well-formed, throw if not."
+ [^String template-name]
+ (when-not (valid-template-name? template-name)
+ (throw (ex-info "invalid template name" {:template-name template-name}))))
(defn render
"Render a template with a context."
([template-name context]
(render @default-hbs template-name context))
([^Handlebars req ^String template-name ctx]
- (validate-template-path! template-name)
+ (validate-template-name! template-name)
(let [template ^Template (.compile req template-name)]
(.apply template (build-context ctx)))))
@@ -100,4 +109,4 @@
(render-string "{{format-date \"2000-01-02\" \"YYYY-dd-MM\" }}" {})
(render-string "Hello {{name}}" {:name "Ngoc"})
(render-string "Hello {{#unless hide_name}}{{name}}{{/unless}}" {:name "Ngoc" :hide_name false})
- (render "metabase/channel/email/_header.hbs" {}))
+ (render "_header" {}))
diff --git a/src/metabase/notification/seed.clj b/src/metabase/notification/seed.clj
index daa33685b21..1538cda90e3 100644
--- a/src/metabase/notification/seed.clj
+++ b/src/metabase/notification/seed.clj
@@ -60,7 +60,7 @@
:channel_type :channel/email
:details {:type "email/handlebars-resource"
:subject "{{payload.custom.user_invited_email_subject}}"
- :path "metabase/channel/email/new_user_invite.hbs"
+ :path "new_user_invite"
:recipient-type "cc"}}
:recipients [{:type :notification-recipient/template
:details {:pattern "{{payload.event_info.object.email}}"}}]}]}
@@ -77,7 +77,7 @@
:channel_type "channel/email"
:details {:type "email/handlebars-resource"
:subject "You set up an alert"
- :path "metabase/channel/email/notification_card_new_confirmation.hbs"
+ :path "notification_card_new_confirmation"
:recipient-type "cc"}}
:recipients [{:type :notification-recipient/template
:details {:pattern "{{payload.event_info.object.creator.email}}"}}]}]}
@@ -94,7 +94,7 @@
:channel_type "channel/email"
:details {:type "email/handlebars-resource"
:subject "Your Slack connection stopped working"
- :path "metabase/channel/email/slack_token_error.hbs"
+ :path "slack_token_error"
:recipient-type "cc"}}
:recipients [{:type :notification-recipient/template
:details {:pattern "{{context.admin_email}}" :is_optional true}}
@@ -113,7 +113,7 @@
:channel_type :channel/email
:details {:type "email/handlebars-resource"
:subject "Comment on {{payload.event_info.entity_title}}"
- :path "metabase/channel/email/comment_created.hbs"
+ :path "comment_created"
:recipient-type "cc"}}
:recipients [{:type :notification-recipient/template
:details {:pattern "{{payload.event_info.email}}"}}]}]}
@@ -130,7 +130,7 @@
:channel_type :channel/email
:details {:type "email/handlebars-resource"
:subject "Support Access Grant Created"
- :path "metabase/channel/email/support_access_grant.hbs"
+ :path "support_access_grant"
:recipient-type "cc"}}
:recipients [{:type :notification-recipient/template
:details {:pattern "{{payload.event_info.support_email}}"}}]}]}
@@ -148,7 +148,7 @@
:channel_type :channel/email
:details {:type "email/handlebars-resource"
:subject "The job \"{{payload.event_info.job_name}}\" had failures"
- :path "metabase/channel/email/transform_failed.hbs"
+ :path "transform_failed"
:recipient-type "cc"}}
:recipients [{:type :notification-recipient/template
:details {:pattern "{{payload.event_info.email}}"}}]}]}
@@ -165,7 +165,7 @@
:channel_type :channel/email
:details {:type "email/handlebars-resource"
:subject "The job \"{{payload.event_info.job_name}}\" had failures"
- :path "metabase/channel/email/transform_failed.hbs"
+ :path "transform_failed"
:recipient-type "bcc"}}
:recipients [{:type :notification-recipient/group
:permissions_group_id (:id (perms/admin-group))}]}]}
@@ -182,7 +182,7 @@
:channel_type :channel/email
:details {:type "email/handlebars-resource"
:subject "Transform jobs that failed in the last day"
- :path "metabase/channel/email/transform_failure_digest.hbs"
+ :path "transform_failure_digest"
:recipient-type "bcc"}}
:recipients [{:type :notification-recipient/group
:permissions_group_id (:id (perms/admin-group))}]}]}]))
diff --git a/src/metabase/pulse/task/email_remove_legacy_pulse.clj b/src/metabase/pulse/task/email_remove_legacy_pulse.clj
index 04ad57296ac..d84b059ecd4 100644
--- a/src/metabase/pulse/task/email_remove_legacy_pulse.clj
+++ b/src/metabase/pulse/task/email_remove_legacy_pulse.clj
@@ -15,7 +15,7 @@
(defn- has-legacy-pulse? []
(pos? (t2/count :model/Pulse :dashboard_id nil :alert_condition nil :archived false)))
-(def ^:private template-path "metabase/channel/email/warn_deprecate_pulse.hbs")
+(def ^:private template-name "warn_deprecate_pulse")
(defn- email-remove-legacy-pulse []
(when (and (channel.settings/email-configured?)
@@ -28,7 +28,7 @@
{:recipients [(:email admin)]
:message-type :html
:subject "[Metabase] Removal of legacy pulses in upcoming Metabase release"
- :message (channel.template/render template-path {:userName (:common_name admin)
+ :message (channel.template/render template-name {:userName (:common_name admin)
:pulses legacy-pulse
:instanceURL (urls/site-url)})})))))
diff --git a/test/metabase/channel/impl/email_test.clj b/test/metabase/channel/impl/email_test.clj
index 7f94761d345..f3a85d285b1 100644
--- a/test/metabase/channel/impl/email_test.clj
+++ b/test/metabase/channel/impl/email_test.clj
@@ -158,7 +158,7 @@
(mt/with-prometheus-system! [_ system]
(let [template {:details {:type :email/handlebars-resource
:subject "Test"
- :path "metabase/channel/email/notification_card.hbs"}}]
+ :path "notification_card"}}]
;; render-body will throw if the payload doesn't match the template, but the metric
;; fires before the render, so we just need to not blow up
(try (#'email.impl/render-body template {})
diff --git a/test/metabase/channel/models/channel_test.clj b/test/metabase/channel/models/channel_test.clj
index a3ce8cbfc99..856211209a5 100644
--- a/test/metabase/channel/models/channel_test.clj
+++ b/test/metabase/channel/models/channel_test.clj
@@ -55,7 +55,7 @@
(testing "success"
(is (some? (insert! {:details {:type "email/handlebars-resource"
:subject "Hello {{name}}"
- :path "metabase/channel/email/password_reset.hbs"}}))))
+ :path "password_reset"}}))))
(testing "invalid path"
(is (thrown? Exception
(insert! {:details {:type "email/handlebars-resource"
diff --git a/test/metabase/channel/template/handlebars_helper_test.clj b/test/metabase/channel/template/handlebars_helper_test.clj
index 912f6d8c475..b12ef988798 100644
--- a/test/metabase/channel/template/handlebars_helper_test.clj
+++ b/test/metabase/channel/template/handlebars_helper_test.clj
@@ -8,7 +8,7 @@
[metabase.util :as u]))
(def custom-hbs
- (handlebars/registry (handlebars/classpath-loader "/" "")))
+ (handlebars/registry (handlebars/default-loader)))
(handlebars-helper/defhelper
format-name
@@ -19,7 +19,7 @@
(str title name)))
(deftest helper-with-keyword-params-test
- (let [hbs (handlebars/registry (handlebars/classpath-loader "/" ""))]
+ (let [hbs (handlebars/registry (handlebars/default-loader))]
(handlebars-helper/register-helper hbs "format-name" format-name)
(is (= "Mr.Romeo" (handlebars/render-string hbs "{{format-name name}}" {:name "Romeo"})))
(is (= "Ms.JULIET" (handlebars/render-string hbs "{{format-name name title=\"Ms.\" uppercase=true}}" {:name "Juliet"})))))
@@ -33,7 +33,7 @@
(handlebars-helper/option-else-block options)))
(deftest block-body-test
- (let [hbs (handlebars/registry (handlebars/classpath-loader "/" ""))
+ (let [hbs (handlebars/registry (handlebars/default-loader))
hot-dog-not-hot-dog #(handlebars/render-string hbs "{{#ifequals food \"Hot Dog\"}}It's a Hot Dog{{else}}Not Hot Dog{{/ifequals}}" {:food %})]
(handlebars-helper/register-helper hbs "ifequals" ifequals)
(is (= "It's a Hot Dog" (hot-dog-not-hot-dog "Hot Dog")))
diff --git a/test/metabase/channel/template/handlebars_test.clj b/test/metabase/channel/template/handlebars_test.clj
index 8f9768377db..358d4a2fc38 100644
--- a/test/metabase/channel/template/handlebars_test.clj
+++ b/test/metabase/channel/template/handlebars_test.clj
@@ -1,38 +1,21 @@
(ns metabase.channel.template.handlebars-test
(:require
[clojure.java.io :as io]
+ [clojure.string :as str]
[clojure.test :refer :all]
[metabase.channel.template.handlebars :as handlebars]
- [metabase.util :as u]
- [metabase.util.random :as u.random])
+ [metabase.util :as u])
(:import
(com.github.jknack.handlebars Helper)))
-(comment
- u.random/keepme)
-
(set! *warn-on-reflection* true)
(def custom-hbs
- (doto (handlebars/registry (handlebars/classpath-loader "/" ""))
+ (doto (handlebars/registry (handlebars/default-loader))
(.registerHelper "uppercase" (reify Helper
(apply [_this arg _options]
(u/upper-case-en arg))))))
-(defn do-with-temp-template!
- [filename content thunk]
- (let [temp-file (format "test_resources/%s" filename)]
- (with-redefs [handlebars/allowed-template-prefixes #{""}]
- (try
- (spit temp-file content)
- (thunk filename)
- (finally
- (io/delete-file temp-file))))))
-
-(defmacro with-temp-template!
- [[filename-binding filename content] & body]
- `(do-with-temp-template! ~filename ~content (fn [~filename-binding] ~@body)))
-
(deftest render-string-test
(testing "Render a template string with a context."
(are [expected template context]
@@ -43,29 +26,65 @@
"Hello Ngoc" "Hello {{who.name}}" {:who {:name "Ngoc"}}
"Hello " "Hello {{#unless hide_name}}{{name}}{{/unless}}" {:name "Ngoc" :hide_name true}
"" "" {})
- (testing "with custom reqistry"
+ (testing "with custom registry"
(is (= "NGOC" (handlebars/render-string custom-hbs "{{uppercase name}}" {:name "Ngoc"}))))))
-(deftest render-test
- (testing "Render a template with a context."
- (with-temp-template! [tmpl-name "tmpl.hbs" "Hello {{name}}"]
- (is (= "Hello Ngoc" (handlebars/render tmpl-name {:name "Ngoc"})))))
- (testing "with custom req"
- (with-temp-template! [tmpl-name "tmpl.hbs" "Hello {{uppercase name}}"]
- (is (= "Hello NGOC" (handlebars/render custom-hbs tmpl-name {:name "Ngoc"}))))))
+(deftest render-resource-by-relative-name-test
+ (testing "renders a template by its relative name (without the .hbs suffix)"
+ (is (= "Hello Ngoc!" (str/trim (handlebars/render "test_greeting" {:name "Ngoc"})))))
+ (testing "renders a template regardless of which template directory holds it"
+ (let [out (handlebars/render "hello_world" {:payload {:event_info {:object {:first_name "Ngoc"}}}
+ :context {:site_name "Metabase"}})]
+ (is (str/includes? out "Hello Ngoc"))
+ (is (str/includes? out "Welcome to Metabase")))))
+
+(deftest partials-resolve-test
+ (testing "renders a template that includes a partial by relative name"
+ (let [out (handlebars/render "test_with_partial" {:name "X"})]
+ (is (str/includes? out "before"))
+ (is (str/includes? out "[partial:X]"))
+ (is (str/includes? out "after")))))
+
+(deftest valid-template-name-test
+ (testing "accepts relative template names"
+ (is (true? (handlebars/valid-template-name? "password_reset")))
+ (is (true? (handlebars/valid-template-name? "notification_card")))
+ (is (true? (handlebars/valid-template-name? "hello_world"))))
+ (testing "rejects malformed names"
+ (is (false? (handlebars/valid-template-name? "")))
+ (is (false? (handlebars/valid-template-name? " ")))
+ (is (false? (handlebars/valid-template-name? "/foo_bar")))
+ (is (false? (handlebars/valid-template-name? "../foo_bar")))
+ (is (false? (handlebars/valid-template-name? "foo/../bar")))
+ (testing "rejects a name that includes the .hbs suffix"
+ (is (false? (handlebars/valid-template-name? "foo_bar.hbs"))))))
+
+(defn- template-basenames
+ "Set of `.hbs` basenames (suffix stripped) in the classpath dir at `prefix`,
+ unioned across every classpath entry containing that dir."
+ [prefix]
+ (let [path (str/replace prefix #"^/|/$" "")
+ loader (.getContextClassLoader (Thread/currentThread))]
+ (->> (enumeration-seq (.getResources loader path))
+ (filter #(= "file" (.getProtocol ^java.net.URL %)))
+ (mapcat #(.listFiles (io/file %)))
+ (filter #(str/ends-with? (.getName ^java.io.File %) ".hbs"))
+ (map #(str/replace (.getName ^java.io.File %) #"\.hbs$" ""))
+ set)))
-(deftest validate-template-path-test
- (testing "valid paths are accepted"
- (is (true? (handlebars/valid-template-path? "metabase/channel/email/password_reset.hbs")))
- (is (true? (handlebars/valid-template-path? "metabase/channel/email/notification_card.hbs")))
- (is (true? (handlebars/valid-template-path? "notification/channel_template/hello_world.hbs"))))
- (is (false? (handlebars/valid-template-path? "foo/bar/baz.hbs")))
- (is (false? (handlebars/valid-template-path? "/metabase/channel/email/foo.hbs")))
- (testing "render rejects invalid paths"
- (is (thrown-with-msg? clojure.lang.ExceptionInfo #"invalid template path"
- (handlebars/render "foo/bar.hbs" {})))
- (is (thrown-with-msg? clojure.lang.ExceptionInfo #"invalid template path"
- (handlebars/render "metabase/channel/email/logo.clj" {})))))
+(deftest template-names-do-not-collide-test
+ (testing "no template name appears in more than one template directory"
+ (let [prefix->names (into {} (for [prefix @#'handlebars/template-dirs]
+ [prefix (template-basenames prefix)]))]
+ (doseq [[prefix names] prefix->names]
+ (testing prefix
+ (is (seq names) "each template directory contains templates")))
+ (let [shared (->> (mapcat seq (vals prefix->names))
+ frequencies
+ (keep (fn [[basename n]] (when (< 1 n) basename)))
+ set)]
+ (is (empty? shared)
+ (str "template name appears in multiple directories: " shared))))))
(deftest dotted-path-resolution-works-on-maps-test
(are [template context]
diff --git a/test/metabase/notification/api/notification_test.clj b/test/metabase/notification/api/notification_test.clj
index ccf666046ed..888809b214f 100644
--- a/test/metabase/notification/api/notification_test.clj
+++ b/test/metabase/notification/api/notification_test.clj
@@ -273,7 +273,7 @@
:channel_type "channel/email"
:details {:type "email/handlebars-resource"
:subject "test"
- :path "metabase/channel/email/password_reset.hbs"}}]
+ :path "password_reset"}}]
(testing "POST /api/notification rejects handlebars-resource templates"
(mt/with-model-cleanup [:model/Notification]
(mt/with-temp [:model/Card {card-id :id} {}]
diff --git a/test/metabase/notification/payload/impl/system_event_test.clj b/test/metabase/notification/payload/impl/system_event_test.clj
index 85779846334..6b0af14e1cd 100644
--- a/test/metabase/notification/payload/impl/system_event_test.clj
+++ b/test/metabase/notification/payload/impl/system_event_test.clj
@@ -66,7 +66,7 @@
(mt/with-temp [:model/ChannelTemplate tmpl {:channel_type :channel/email
:details {:type :email/handlebars-resource
:subject "Welcome {{payload.event_info.object.first_name}} to {{context.site_name}}"
- :path "notification/channel_template/hello_world.hbs"}}
+ :path "hello_world"}}
:model/User {user-id :id} {:email "[email protected]"}
:model/PermissionsGroup {group-id :id} {:name "Avengers"}
:model/PermissionsGroupMembership _ {:group_id group-id
diff --git a/test/metabase/notification/seed_test.clj b/test/metabase/notification/seed_test.clj
index e2fe56afba4..4ff50200e14 100644
--- a/test/metabase/notification/seed_test.clj
+++ b/test/metabase/notification/seed_test.clj
@@ -3,11 +3,14 @@
[clojure.test :refer :all]
[clojure.walk :as walk]
[medley.core :as m]
+ [metabase.channel.template.handlebars :as handlebars]
[metabase.notification.models :as models.notification]
[metabase.notification.seed :as notification.seed]
[metabase.test :as mt]
[toucan2.core :as t2]))
+(set! *warn-on-reflection* true)
+
(defn- nullify-timestamp
[data]
(walk/postwalk
@@ -36,6 +39,19 @@
(testing "it equals to the data before "
(is (= before (get-notifications-data))))))))
+(deftest seeded-template-paths-resolve-test
+ (testing "every seeded handlebars-resource :path resolves through the template loader"
+ (let [loader (handlebars/default-loader)
+ paths (for [notification @@#'notification.seed/default-notifications
+ handler (:handlers notification)
+ :let [details (get-in handler [:template :details])]
+ :when (= "email/handlebars-resource" (:type details))]
+ (:path details))]
+ (is (seq paths) "seed must contain handlebars-resource templates, else this test proves nothing")
+ (doseq [path paths]
+ (testing path
+ (is (some? (.sourceAt loader path))))))))
+
(deftest sync-notification!-test
(let [internal-id (mt/random-name)
template-name (mt/random-name)
@@ -87,6 +103,8 @@
(is (= :replace (check-change (assoc-in test-notification [:subscriptions 0 :event_name] :event/user-uninvited)))))
(testing ":replace if template changed"
(is (= :replace (check-change (assoc-in test-notification [:handlers 0 :template :name] "new name")))))
+ (testing ":replace if template :details :path changes"
+ (is (= :replace (check-change (assoc-in test-notification [:handlers 0 :template :details :path] "renamed_template")))))
(testing ":replace if handlers.active changed"
(is (= :replace (check-change (assoc-in test-notification [:handlers 0 :active] not)))))
(testing ":replace if recipients changed"
diff --git a/test_resources/notification/channel_template/test_greeting.hbs b/test_resources/notification/channel_template/test_greeting.hbs
new file mode 100644
index 00000000000..6cb905fab46
--- /dev/null
+++ b/test_resources/notification/channel_template/test_greeting.hbs
@@ -0,0 +1 @@
+Hello {{name}}!
diff --git a/test_resources/notification/channel_template/test_partial.hbs b/test_resources/notification/channel_template/test_partial.hbs
new file mode 100644
index 00000000000..462384fa8c6
--- /dev/null
+++ b/test_resources/notification/channel_template/test_partial.hbs
@@ -0,0 +1 @@
+[partial:{{name}}]
diff --git a/test_resources/notification/channel_template/test_with_partial.hbs b/test_resources/notification/channel_template/test_with_partial.hbs
new file mode 100644
index 00000000000..603755503f1
--- /dev/null
+++ b/test_resources/notification/channel_template/test_with_partial.hbs
@@ -0,0 +1 @@
+before {{> test_partial}} after