FIX: Some errors that only appear in Ember 1.13

This commit is contained in:
Robin Ward 2016-10-26 16:26:10 -04:00
parent 7953a53cc5
commit 004e71a3fe
4 changed files with 11 additions and 5 deletions

View File

@ -3,8 +3,11 @@ import { get } from 'discourse-common/lib/raw-handlebars';
// `Ember.Helper` is only available in versions after 1.12
export function htmlHelper(fn) {
if (Ember.Helper) {
return Ember.Helper.helper(function() {
return new Handlebars.SafeString(fn.apply(this, Array.prototype.slice.call(arguments)) || '');
return Ember.Helper.helper(function(...args) {
if (args.length > 1) {
args[1] = { hash: args[1] };
}
return new Handlebars.SafeString(fn.apply(this, args) || '');
});
} else {
return Ember.Handlebars.makeBoundHelper(function() {

View File

@ -20,7 +20,10 @@ export default DiscoveryController.extend({
@computed("model.parentCategory")
categoryPageStyle(parentCategory) {
const style = this.siteSettings.desktop_category_page_style;
return parentCategory && style === "categories_and_latest_topics" ? "categories_only" : style;
const componentName = (parentCategory && style === "categories_and_latest_topics") ?
"categories_only" :
style;
return Ember.String.dasherize(componentName);
}
});

View File

@ -6,8 +6,8 @@ export default htmlHelper((user, args) => {
if (!user) { return; }
const name = escapeExpression(user.get('name'));
let currentUser = args.currentUser;
if (!currentUser && args.hash) {
let currentUser;
if (args && args.hash) {
currentUser = args.hash.currentUser;
}