diff --git a/app/assets/javascripts/discourse-common/lib/helpers.js.es6 b/app/assets/javascripts/discourse-common/lib/helpers.js.es6 index e7bd491c449..486e5b3ebdd 100644 --- a/app/assets/javascripts/discourse-common/lib/helpers.js.es6 +++ b/app/assets/javascripts/discourse-common/lib/helpers.js.es6 @@ -1,13 +1,14 @@ import { get } from 'discourse-common/lib/raw-handlebars'; +function fixArgs(args) { + return (args.length > 1) ? args[0].concat(args[args.length-1]) : args; +} + // `Ember.Helper` is only available in versions after 1.12 export function htmlHelper(fn) { if (Ember.Helper) { return Ember.Helper.helper(function(...args) { - if (args.length > 1) { - args = args[0].concat(args[args.length-1]); - } - return new Handlebars.SafeString(fn.apply(this, args) || ''); + return new Handlebars.SafeString(fn.apply(this, fixArgs(args)) || ''); }); } else { return Ember.Handlebars.makeBoundHelper(function() { diff --git a/app/assets/javascripts/discourse/helpers/custom-html.js.es6 b/app/assets/javascripts/discourse/helpers/custom-html.js.es6 index f3749dfc4d9..5c77dbaf49f 100644 --- a/app/assets/javascripts/discourse/helpers/custom-html.js.es6 +++ b/app/assets/javascripts/discourse/helpers/custom-html.js.es6 @@ -20,7 +20,7 @@ export function setCustomHTML(key, html) { _customizations[key] = html; } -registerHelper('custom-html', function(params) { - const html = getCustomHTML(params[0]); +registerHelper('custom-html', function([id]) { + const html = getCustomHTML(id); if (html) { return html; } }); diff --git a/app/assets/javascripts/discourse/helpers/inline-date.js.es6 b/app/assets/javascripts/discourse/helpers/inline-date.js.es6 index 874434fd3c9..f483802ee09 100644 --- a/app/assets/javascripts/discourse/helpers/inline-date.js.es6 +++ b/app/assets/javascripts/discourse/helpers/inline-date.js.es6 @@ -1,6 +1,8 @@ import { relativeAge } from 'discourse/lib/formatter'; +import { registerHelper } from 'discourse-common/lib/helpers'; -export default function(dt, params) { - dt = params.data.view.getStream(dt).value(); +registerHelper('inline-date', function([dt]) { + // TODO: Remove this in 1.13 or greater + if (dt.value) { dt = dt.value(); } return relativeAge(new Date(dt)); -} +}); diff --git a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 index 4426714bf1c..602426d2c6b 100644 --- a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 +++ b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 @@ -118,7 +118,7 @@ function viewInjections(container) { } // unbound version of outlets, only has a template -Handlebars.registerHelper('plugin-outlet', function(name){ +Handlebars.registerHelper('plugin-outlet', function(name) { if (!_rawCache) { buildConnectorCache(); } const functions = _rawCache[name]; @@ -134,9 +134,7 @@ Handlebars.registerHelper('plugin-outlet', function(name){ }); -registerHelper('plugin-outlet', function(params, hash, options, env) { - const connectionName = params[0]; - +registerHelper('plugin-outlet', function([connectionName], hash, options, env) { if (!_connectorCache) { buildConnectorCache(); } if (_connectorCache[connectionName]) {