mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Import EmberObject rather than global variable (#8256)
* DEV: Import ember/object rather than Ember.Object globally * fixed broken object proxy import * prettier on js * added @ember/object/proxy to loader * added unstaged file * Fixed objet proxy reference is loader * Linting!
This commit is contained in:
committed by
GitHub
parent
74dc37c07c
commit
c7475ee03b
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
import ReportLoader from "discourse/lib/reports-loader";
|
||||
import { exportEntity } from "discourse/lib/export-csv";
|
||||
@@ -368,12 +369,12 @@ export default Component.extend({
|
||||
_buildOptions(mode) {
|
||||
if (mode === "table") {
|
||||
const tableOptions = JSON.parse(JSON.stringify(TABLE_OPTIONS));
|
||||
return Ember.Object.create(
|
||||
return EmberObject.create(
|
||||
Object.assign(tableOptions, this.get("reportOptions.table") || {})
|
||||
);
|
||||
} else {
|
||||
const chartOptions = JSON.parse(JSON.stringify(CHART_OPTIONS));
|
||||
return Ember.Object.create(
|
||||
return EmberObject.create(
|
||||
Object.assign(chartOptions, this.get("reportOptions.chart") || {})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
@@ -21,7 +22,7 @@ export default Component.extend({
|
||||
|
||||
if (!this.location) {
|
||||
ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then(location =>
|
||||
this.set("location", Ember.Object.create(location))
|
||||
this.set("location", EmberObject.create(location))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
@@ -15,7 +16,7 @@ export default Controller.extend({
|
||||
|
||||
@computed("baseColorScheme")
|
||||
baseColors(baseColorScheme) {
|
||||
const baseColorsHash = Ember.Object.create({});
|
||||
const baseColorsHash = EmberObject.create({});
|
||||
baseColorScheme.get("colors").forEach(color => {
|
||||
baseColorsHash.set(color.get("name"), color);
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
export default Controller.extend({
|
||||
@@ -12,7 +13,7 @@ export default Controller.extend({
|
||||
actions: {
|
||||
emojiUploaded(emoji) {
|
||||
emoji.url += "?t=" + new Date().getTime();
|
||||
this.model.pushObject(Ember.Object.create(emoji));
|
||||
this.model.pushObject(EmberObject.create(emoji));
|
||||
},
|
||||
|
||||
destroy(emoji) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import { exportEntity } from "discourse/lib/export-csv";
|
||||
import { outputExportResult } from "discourse/lib/export-result";
|
||||
@@ -20,14 +21,14 @@ export default Controller.extend({
|
||||
@on("init")
|
||||
resetFilters() {
|
||||
this.setProperties({
|
||||
model: Ember.Object.create({ loadingMore: true }),
|
||||
filters: Ember.Object.create()
|
||||
model: EmberObject.create({ loadingMore: true }),
|
||||
filters: EmberObject.create()
|
||||
});
|
||||
this.scheduleRefresh();
|
||||
},
|
||||
|
||||
_changeFilters(props) {
|
||||
this.set("model", Ember.Object.create({ loadingMore: true }));
|
||||
this.set("model", EmberObject.create({ loadingMore: true }));
|
||||
this.filters.setProperties(props);
|
||||
this.scheduleRefresh();
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
|
||||
@@ -28,7 +29,7 @@ export default Controller.extend({
|
||||
return wordRecord.word.indexOf(filter) > -1;
|
||||
});
|
||||
matchesByAction.pushObject(
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
nameKey: wordsForAction.nameKey,
|
||||
name: wordsForAction.name,
|
||||
words: wordRecords,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import round from "discourse/lib/round";
|
||||
@@ -323,7 +324,7 @@ const Report = Discourse.Model.extend({
|
||||
const formatedValue = () => {
|
||||
const userId = row[properties.id];
|
||||
|
||||
const user = Ember.Object.create({
|
||||
const user = EmberObject.create({
|
||||
username,
|
||||
name: formatUsername(username),
|
||||
avatar_template: row[properties.avatar]
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import { i18n } from "discourse/lib/computed";
|
||||
|
||||
const UserField = RestModel.extend();
|
||||
|
||||
const UserFieldType = Ember.Object.extend({
|
||||
const UserFieldType = EmberObject.extend({
|
||||
name: i18n("id", "admin.user_fields.field_types.%@")
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Route from "@ember/routing/route";
|
||||
import PreloadStore from "preload-store";
|
||||
|
||||
@@ -16,7 +17,7 @@ export default Route.extend({
|
||||
return log.message.length === 0 || log.message[0] === "[";
|
||||
})
|
||||
.map(function(log) {
|
||||
return Ember.Object.create(log);
|
||||
return EmberObject.create(log);
|
||||
})
|
||||
.value();
|
||||
logs.pushObjects(newLogs);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
@@ -42,7 +43,7 @@ export default DiscourseRoute.extend({
|
||||
} else {
|
||||
this.controllerFor("adminBackupsLogs")
|
||||
.get("logs")
|
||||
.pushObject(Ember.Object.create(log));
|
||||
.pushObject(EmberObject.create(log));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
@@ -5,7 +6,7 @@ export default DiscourseRoute.extend({
|
||||
model: function() {
|
||||
return ajax("/admin/customize/emojis.json").then(function(emojis) {
|
||||
return emojis.map(function(emoji) {
|
||||
return Ember.Object.create(emoji);
|
||||
return EmberObject.create(emoji);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
@@ -12,7 +13,7 @@ export default DiscourseRoute.extend({
|
||||
return ajax("/admin/logs/search_logs.json", {
|
||||
data: { period: params.period, search_type: params.searchType }
|
||||
}).then(search_logs => {
|
||||
return search_logs.map(sl => Ember.Object.create(sl));
|
||||
return search_logs.map(sl => EmberObject.create(sl));
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { fillMissingDates } from "discourse/lib/utilities";
|
||||
@@ -33,7 +34,7 @@ export default DiscourseRoute.extend({
|
||||
json.term.search_result = translateResults(json.term.search_result);
|
||||
}
|
||||
|
||||
const model = Ember.Object.create({ type: "search_log_term" });
|
||||
const model = EmberObject.create({ type: "search_log_term" });
|
||||
model.setProperties(json.term);
|
||||
return model;
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
@@ -11,7 +12,7 @@ export default DiscourseRoute.extend({
|
||||
"categoryNameKey",
|
||||
params.category_id
|
||||
);
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
nameKey: params.category_id,
|
||||
name: I18n.t("admin.site_settings.categories." + params.category_id),
|
||||
siteSettings: this.controllerFor("adminSiteSettingsCategory").get(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
@@ -9,7 +10,7 @@ export default DiscourseRoute.extend({
|
||||
let filteredContent = this.controllerFor("adminWatchedWordsAction").get(
|
||||
"filteredContent"
|
||||
);
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
nameKey: params.action_id,
|
||||
name: I18n.t("admin.watched_words.actions." + params.action_id),
|
||||
words: filteredContent
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// and the admin application. Use this if you need front end code to access admin
|
||||
// modules. Inject it optionally, and if it exists go to town!
|
||||
|
||||
import EmberObject from "@ember/object";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
@@ -22,7 +23,7 @@ export default Service.extend({
|
||||
"controller:adminLogs.staffActionLogs"
|
||||
);
|
||||
target.transitionToRoute("adminLogs.staffActionLogs").then(() => {
|
||||
controller.set("filters", Ember.Object.create());
|
||||
controller.set("filters", EmberObject.create());
|
||||
controller._changeFilters(filters);
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user