`Ember.keys` is deprected in favor of `Object.keys`
This commit is contained in:
parent
187d7d6f96
commit
400c061046
|
@ -107,7 +107,7 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
|
||||||
|
|
||||||
$('noscript').remove();
|
$('noscript').remove();
|
||||||
|
|
||||||
Ember.keys(requirejs._eak_seen).forEach(function(key) {
|
Object.keys(requirejs._eak_seen).forEach(function(key) {
|
||||||
if (/\/pre\-initializers\//.test(key)) {
|
if (/\/pre\-initializers\//.test(key)) {
|
||||||
var module = require(key, null, null, true);
|
var module = require(key, null, null, true);
|
||||||
if (!module) { throw new Error(key + ' must export an initializer.'); }
|
if (!module) { throw new Error(key + ' must export an initializer.'); }
|
||||||
|
@ -115,7 +115,7 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ember.keys(requirejs._eak_seen).forEach(function(key) {
|
Object.keys(requirejs._eak_seen).forEach(function(key) {
|
||||||
if (/\/initializers\//.test(key)) {
|
if (/\/initializers\//.test(key)) {
|
||||||
var module = require(key, null, null, true);
|
var module = require(key, null, null, true);
|
||||||
if (!module) { throw new Error(key + ' must export an initializer.'); }
|
if (!module) { throw new Error(key + ' must export an initializer.'); }
|
||||||
|
|
|
@ -218,7 +218,7 @@ export default Ember.Component.extend({
|
||||||
const mouseTrap = Mousetrap(this.$('.d-editor-input')[0]);
|
const mouseTrap = Mousetrap(this.$('.d-editor-input')[0]);
|
||||||
|
|
||||||
const shortcuts = this.get('toolbar.shortcuts');
|
const shortcuts = this.get('toolbar.shortcuts');
|
||||||
Ember.keys(shortcuts).forEach(sc => {
|
Object.keys(shortcuts).forEach(sc => {
|
||||||
const button = shortcuts[sc];
|
const button = shortcuts[sc];
|
||||||
mouseTrap.bind(sc, () => {
|
mouseTrap.bind(sc, () => {
|
||||||
this.send(button.action, button);
|
this.send(button.action, button);
|
||||||
|
@ -244,7 +244,7 @@ export default Ember.Component.extend({
|
||||||
this.appEvents.off('composer:insert-text');
|
this.appEvents.off('composer:insert-text');
|
||||||
|
|
||||||
const mouseTrap = this._mouseTrap;
|
const mouseTrap = this._mouseTrap;
|
||||||
Ember.keys(this.get('toolbar.shortcuts')).forEach(sc => mouseTrap.unbind(sc));
|
Object.keys(this.get('toolbar.shortcuts')).forEach(sc => mouseTrap.unbind(sc));
|
||||||
this.$('.d-editor-preview').off('click.preview');
|
this.$('.d-editor-preview').off('click.preview');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ export var queryParams = {
|
||||||
// Basic controller options
|
// Basic controller options
|
||||||
var controllerOpts = {
|
var controllerOpts = {
|
||||||
needs: ['discovery/topics'],
|
needs: ['discovery/topics'],
|
||||||
queryParams: Ember.keys(queryParams),
|
queryParams: Object.keys(queryParams),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Aliases for the values
|
// Aliases for the values
|
||||||
|
|
|
@ -142,7 +142,7 @@ const controllerOpts = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ember.keys(queryParams).forEach(function(p) {
|
Object.keys(queryParams).forEach(function(p) {
|
||||||
// If we don't have a default value, initialize it to null
|
// If we don't have a default value, initialize it to null
|
||||||
if (typeof controllerOpts[p] === 'undefined') {
|
if (typeof controllerOpts[p] === 'undefined') {
|
||||||
controllerOpts[p] = null;
|
controllerOpts[p] = null;
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default Ember.DefaultResolver.extend({
|
||||||
// If we end with the name we want, use it. This allows us to define components within plugins.
|
// If we end with the name we want, use it. This allows us to define components within plugins.
|
||||||
const suffix = parsedName.type + 's/' + parsedName.fullNameWithoutType,
|
const suffix = parsedName.type + 's/' + parsedName.fullNameWithoutType,
|
||||||
dashed = Ember.String.dasherize(suffix),
|
dashed = Ember.String.dasherize(suffix),
|
||||||
moduleName = Ember.keys(requirejs.entries).find(function(e) {
|
moduleName = Object.keys(requirejs.entries).find(function(e) {
|
||||||
return (e.indexOf(suffix, e.length - suffix.length) !== -1) ||
|
return (e.indexOf(suffix, e.length - suffix.length) !== -1) ||
|
||||||
(e.indexOf(dashed, e.length - dashed.length) !== -1);
|
(e.indexOf(dashed, e.length - dashed.length) !== -1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,7 +60,7 @@ function findOutlets(collection, callback) {
|
||||||
|
|
||||||
const disabledPlugins = Discourse.Site.currentProp('disabled_plugins') || [];
|
const disabledPlugins = Discourse.Site.currentProp('disabled_plugins') || [];
|
||||||
|
|
||||||
Ember.keys(collection).forEach(function(res) {
|
Object.keys(collection).forEach(function(res) {
|
||||||
if (res.indexOf("/connectors/") !== -1) {
|
if (res.indexOf("/connectors/") !== -1) {
|
||||||
// Skip any disabled plugins
|
// Skip any disabled plugins
|
||||||
for (let i=0; i<disabledPlugins.length; i++) {
|
for (let i=0; i<disabledPlugins.length; i++) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ function resolveParams(ctx, options) {
|
||||||
|
|
||||||
if (hash) {
|
if (hash) {
|
||||||
if (options.hashTypes) {
|
if (options.hashTypes) {
|
||||||
Ember.keys(hash).forEach(function(k) {
|
Object.keys(hash).forEach(function(k) {
|
||||||
const type = options.hashTypes[k];
|
const type = options.hashTypes[k];
|
||||||
if (type === "STRING" || type === "StringLiteral") {
|
if (type === "STRING" || type === "StringLiteral") {
|
||||||
params[k] = hash[k];
|
params[k] = hash[k];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export function autoLoadModules() {
|
export function autoLoadModules() {
|
||||||
Ember.keys(requirejs.entries).forEach(entry => {
|
Object.keys(requirejs.entries).forEach(entry => {
|
||||||
if ((/\/helpers\//).test(entry)) {
|
if ((/\/helpers\//).test(entry)) {
|
||||||
require(entry, null, null, true);
|
require(entry, null, null, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ const Post = RestModel.extend({
|
||||||
// Put the metaData into the request
|
// Put the metaData into the request
|
||||||
if (metaData) {
|
if (metaData) {
|
||||||
data.meta_data = {};
|
data.meta_data = {};
|
||||||
Ember.keys(metaData).forEach(function(key) { data.meta_data[key] = metaData.get(key); });
|
Object.keys(metaData).forEach(function(key) { data.meta_data[key] = metaData.get(key); });
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
|
@ -41,7 +41,7 @@ const Site = RestModel.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ember.keys(remaining).forEach(parentCategoryId => {
|
Object.keys(remaining).forEach(parentCategoryId => {
|
||||||
const category = result.findBy('id', parseInt(parentCategoryId, 10)),
|
const category = result.findBy('id', parseInt(parentCategoryId, 10)),
|
||||||
index = result.indexOf(category);
|
index = result.indexOf(category);
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ const User = RestModel.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
copy() {
|
copy() {
|
||||||
return Discourse.User.create(this.getProperties(Ember.keys(this)));
|
return Discourse.User.create(this.getProperties(Object.keys(this)));
|
||||||
},
|
},
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
|
|
@ -15,7 +15,7 @@ export function mapRoutes() {
|
||||||
// will be built automatically. You can supply a `resource` property to
|
// will be built automatically. You can supply a `resource` property to
|
||||||
// automatically put it in that resource, such as `admin`. That way plugins
|
// automatically put it in that resource, such as `admin`. That way plugins
|
||||||
// can define admin routes.
|
// can define admin routes.
|
||||||
Ember.keys(requirejs._eak_seen).forEach(function(key) {
|
Object.keys(requirejs._eak_seen).forEach(function(key) {
|
||||||
if (/route-map$/.test(key)) {
|
if (/route-map$/.test(key)) {
|
||||||
var module = require(key, null, null, true);
|
var module = require(key, null, null, true);
|
||||||
if (!module || !module.default) { throw new Error(key + ' must export a route map.'); }
|
if (!module || !module.default) { throw new Error(key + ' must export a route map.'); }
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { queryParams } from 'discourse/controllers/discovery-sortable';
|
||||||
function filterQueryParams(params, defaultParams) {
|
function filterQueryParams(params, defaultParams) {
|
||||||
const findOpts = defaultParams || {};
|
const findOpts = defaultParams || {};
|
||||||
if (params) {
|
if (params) {
|
||||||
Ember.keys(queryParams).forEach(function(opt) {
|
Object.keys(queryParams).forEach(function(opt) {
|
||||||
if (params[opt]) { findOpts[opt] = params[opt]; }
|
if (params[opt]) { findOpts[opt] = params[opt]; }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ function findTopicList(store, tracking, filter, filterParams, extras) {
|
||||||
|
|
||||||
// Clean up any string parameters that might slip through
|
// Clean up any string parameters that might slip through
|
||||||
filterParams = filterParams || {};
|
filterParams = filterParams || {};
|
||||||
Ember.keys(filterParams).forEach(function(k) {
|
Object.keys(filterParams).forEach(function(k) {
|
||||||
const val = filterParams[k];
|
const val = filterParams[k];
|
||||||
if (val === "undefined" || val === "null" || val === 'false') {
|
if (val === "undefined" || val === "null" || val === 'false') {
|
||||||
filterParams[k] = undefined;
|
filterParams[k] = undefined;
|
||||||
|
|
|
@ -3,12 +3,12 @@ export default function(helpers) {
|
||||||
const fixturesByUrl = {};
|
const fixturesByUrl = {};
|
||||||
|
|
||||||
// Load any fixtures automatically
|
// Load any fixtures automatically
|
||||||
Ember.keys(require._eak_seen).forEach(entry => {
|
Object.keys(require._eak_seen).forEach(entry => {
|
||||||
if (/^fixtures/.test(entry)) {
|
if (/^fixtures/.test(entry)) {
|
||||||
const fixture = require(entry, null, null, true);
|
const fixture = require(entry, null, null, true);
|
||||||
if (fixture && fixture.default) {
|
if (fixture && fixture.default) {
|
||||||
const obj = fixture.default;
|
const obj = fixture.default;
|
||||||
Ember.keys(obj).forEach(url => {
|
Object.keys(obj).forEach(url => {
|
||||||
fixturesByUrl[url] = obj[url];
|
fixturesByUrl[url] = obj[url];
|
||||||
this.get(url, () => response(obj[url]));
|
this.get(url, () => response(obj[url]));
|
||||||
});
|
});
|
||||||
|
|
|
@ -132,7 +132,7 @@ window.asyncTestDiscourse = helpers.asyncTestDiscourse;
|
||||||
window.controllerFor = helpers.controllerFor;
|
window.controllerFor = helpers.controllerFor;
|
||||||
window.fixture = helpers.fixture;
|
window.fixture = helpers.fixture;
|
||||||
|
|
||||||
Ember.keys(requirejs.entries).forEach(function(entry) {
|
Object.keys(requirejs.entries).forEach(function(entry) {
|
||||||
if ((/\-test/).test(entry)) {
|
if ((/\-test/).test(entry)) {
|
||||||
require(entry, null, null, true);
|
require(entry, null, null, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue