FIX: Allow subexpressions in raw handlebars helpers

FIX: Allow subexpressions in raw handlebars helpers

Helpers registered via registerUnbound did not receive parameters if they were subexpressions. For example: {{helper1 key=(helper2 value)}}

diff --git a/app/assets/javascripts/discourse-common/lib/helpers.js.es6 b/app/assets/javascripts/discourse-common/lib/helpers.js.es6
index bbaaf62..907ae24 100644
--- a/app/assets/javascripts/discourse-common/lib/helpers.js.es6
+++ b/app/assets/javascripts/discourse-common/lib/helpers.js.es6
@@ -32,7 +32,11 @@ function resolveParams(ctx, options) {
     if (options.hashTypes) {
       Object.keys(hash).forEach(function(k) {
         const type = options.hashTypes[k];
-        if (type === "STRING" || type === "StringLiteral") {
+        if (
+          type === "STRING" ||
+          type === "StringLiteral" ||
+          type === "SubExpression"
+        ) {
           params[k] = hash[k];
         } else if (type === "ID" || type === "PathExpression") {
           params[k] = get(ctx, hash[k], options);

GitHub sha: babd80df

2 Likes