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:
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);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -12,6 +12,7 @@ var define, requirejs;
|
|||
inject: Ember.inject.controller
|
||||
},
|
||||
"@ember/object": { default: Ember.Object },
|
||||
"@ember/object/proxy": { default: Ember.ObjectProxy },
|
||||
"@ember/routing/route": { default: Ember.Route },
|
||||
"@ember/service": {
|
||||
default: Ember.Service,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { hashString } from "discourse/lib/hash";
|
||||
|
||||
|
@ -24,7 +25,7 @@ function rethrow(error) {
|
|||
throw error;
|
||||
}
|
||||
|
||||
export default Ember.Object.extend({
|
||||
export default EmberObject.extend({
|
||||
storageKey(type, findArgs, options) {
|
||||
if (options && options.cacheKey) {
|
||||
return options.cacheKey;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
import LinkLookup from "discourse/lib/link-lookup";
|
||||
|
||||
|
@ -122,7 +123,7 @@ export default Component.extend({
|
|||
|
||||
_create(info) {
|
||||
this.reset();
|
||||
this.send("popup", Ember.Object.create(info));
|
||||
this.send("popup", EmberObject.create(info));
|
||||
},
|
||||
|
||||
_findSimilar() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
|
@ -33,7 +34,7 @@ export default buildCategoryPanel("images").extend({
|
|||
_deleteUpload(path) {
|
||||
this.set(
|
||||
path,
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
id: null,
|
||||
url: null
|
||||
})
|
||||
|
@ -43,7 +44,7 @@ export default buildCategoryPanel("images").extend({
|
|||
_setFromUpload(path, upload) {
|
||||
this.set(
|
||||
path,
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
url: upload.url,
|
||||
id: upload.id
|
||||
})
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
import { emailValid } from "discourse/lib/utilities";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
@ -324,7 +325,7 @@ export default Component.extend({
|
|||
.then(data => {
|
||||
model.setProperties({ saving: false, finished: true });
|
||||
this.get("inviteModel.details.allowed_groups").pushObject(
|
||||
Ember.Object.create(data.group)
|
||||
EmberObject.create(data.group)
|
||||
);
|
||||
this.appEvents.trigger("post-stream:refresh");
|
||||
})
|
||||
|
@ -350,7 +351,7 @@ export default Component.extend({
|
|||
});
|
||||
} else if (this.isPM && result && result.user) {
|
||||
this.get("inviteModel.details.allowed_users").pushObject(
|
||||
Ember.Object.create(result.user)
|
||||
EmberObject.create(result.user)
|
||||
);
|
||||
this.appEvents.trigger("post-stream:refresh");
|
||||
} else if (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
|
@ -14,7 +15,7 @@ export default Component.extend(PanEvents, {
|
|||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set("info", Ember.Object.create());
|
||||
this.set("info", EmberObject.create());
|
||||
},
|
||||
|
||||
_performCheckSize() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -84,7 +85,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
|
|||
const value = userFields ? userFields[field.get("id")] : null;
|
||||
return Ember.isEmpty(value)
|
||||
? null
|
||||
: Ember.Object.create({ value, field });
|
||||
: EmberObject.create({ value, field });
|
||||
})
|
||||
.compact();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { inject } from "@ember/controller";
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import Badge from "discourse/models/badge";
|
||||
import UserBadge from "discourse/models/user-badge";
|
||||
|
@ -22,7 +23,7 @@ export default Controller.extend({
|
|||
@computed("filteredList")
|
||||
selectableUserBadges(filteredList) {
|
||||
return [
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
badge: Badge.create({ name: I18n.t("badges.none") })
|
||||
}),
|
||||
...filteredList.uniqBy("badge.name")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
@ -87,7 +88,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
} else {
|
||||
const topicTimer =
|
||||
this.isPublic === "true" ? "topic_timer" : "private_topic_timer";
|
||||
this.set(`model.${topicTimer}`, Ember.Object.create({}));
|
||||
this.set(`model.${topicTimer}`, EmberObject.create({}));
|
||||
|
||||
this.setProperties({
|
||||
selection: null
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import ActionSummary from "discourse/models/action-summary";
|
||||
|
@ -58,7 +59,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
return flagsAvailable;
|
||||
} else {
|
||||
// flagging topic
|
||||
let lookup = Ember.Object.create();
|
||||
let lookup = EmberObject.create();
|
||||
let model = this.model;
|
||||
model.get("actions_summary").forEach(a => {
|
||||
a.flagTopic = model;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { inject } from "@ember/controller";
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -13,7 +14,7 @@ export default Controller.extend({
|
|||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set("filters", Ember.Object.create());
|
||||
this.set("filters", EmberObject.create());
|
||||
},
|
||||
|
||||
@computed(
|
||||
|
@ -53,7 +54,7 @@ export default Controller.extend({
|
|||
reset() {
|
||||
this.setProperties({
|
||||
offset: 0,
|
||||
filters: Ember.Object.create()
|
||||
filters: EmberObject.create()
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const Tab = Ember.Object.extend({
|
||||
const Tab = EmberObject.extend({
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
let name = this.name;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
@ -378,7 +379,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
accountEmail: options.email,
|
||||
accountUsername: options.username,
|
||||
accountName: options.name,
|
||||
authOptions: Ember.Object.create(options)
|
||||
authOptions: EmberObject.create(options)
|
||||
});
|
||||
|
||||
showModal("createAccount");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import PreferencesTabController from "discourse/mixins/preferences-tab-controller";
|
||||
|
@ -34,7 +35,7 @@ export default Controller.extend(PreferencesTabController, {
|
|||
const value = userFields
|
||||
? userFields[field.get("id").toString()]
|
||||
: null;
|
||||
return Ember.Object.create({ value, field });
|
||||
return EmberObject.create({ value, field });
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObjectProxy from "@ember/object/proxy";
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
@ -23,7 +24,7 @@ export default Controller.extend(ModalFunctionality, Ember.Evented, {
|
|||
|
||||
@computed("site.categories")
|
||||
categoriesBuffered(categories) {
|
||||
const bufProxy = Ember.ObjectProxy.extend(BufferedProxy);
|
||||
const bufProxy = EmberObjectProxy.extend(BufferedProxy);
|
||||
return categories.map(c => bufProxy.create({ content: c }));
|
||||
},
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
|
@ -1058,7 +1059,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
statusType,
|
||||
null
|
||||
)
|
||||
.then(() => this.set(`model.${topicTimer}`, Ember.Object.create({})))
|
||||
.then(() => this.set(`model.${topicTimer}`, EmberObject.create({})))
|
||||
.catch(error => popupAjaxError(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
|
@ -124,7 +125,7 @@ export default Controller.extend(CanCheckEmails, {
|
|||
: null;
|
||||
return Ember.isEmpty(value)
|
||||
? null
|
||||
: Ember.Object.create({ value, field });
|
||||
: EmberObject.create({ value, field });
|
||||
})
|
||||
.compact();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import PreloadStore from "preload-store";
|
||||
|
||||
export default {
|
||||
|
@ -5,7 +6,7 @@ export default {
|
|||
after: "message-bus",
|
||||
|
||||
initialize(container) {
|
||||
const banner = Ember.Object.create(PreloadStore.get("banner") || {}),
|
||||
const banner = EmberObject.create(PreloadStore.get("banner") || {}),
|
||||
site = container.lookup("site:main");
|
||||
|
||||
site.set("banner", banner);
|
||||
|
@ -16,7 +17,7 @@ export default {
|
|||
}
|
||||
|
||||
messageBus.subscribe("/site/banner", function(ban) {
|
||||
site.set("banner", Ember.Object.create(ban || {}));
|
||||
site.set("banner", EmberObject.create(ban || {}));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
// Subscribes to user events on the message bus
|
||||
import {
|
||||
init as initDesktopNotifications,
|
||||
|
@ -82,7 +83,7 @@ export default {
|
|||
}
|
||||
oldNotifications.insertAt(
|
||||
insertPosition,
|
||||
Ember.Object.create(lastNotification)
|
||||
EmberObject.create(lastNotification)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { defaultHomepage } from "discourse/lib/utilities";
|
||||
let popstateFired = false;
|
||||
const supportsHistoryState = window.history && "state" in window.history;
|
||||
|
@ -9,9 +10,9 @@ const popstateCallbacks = [];
|
|||
|
||||
@class DiscourseLocation
|
||||
@namespace Discourse
|
||||
@extends Ember.Object
|
||||
@extends @ember/object
|
||||
*/
|
||||
const DiscourseLocation = Ember.Object.extend({
|
||||
const DiscourseLocation = EmberObject.extend({
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export function Placeholder(viewName) {
|
||||
this.viewName = viewName;
|
||||
}
|
||||
|
||||
export default Ember.Object.extend(Ember.Array, {
|
||||
export default EmberObject.extend(Ember.Array, {
|
||||
posts: null,
|
||||
_appendingIds: null,
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { findRawTemplate } from "discourse/lib/raw-templates";
|
||||
import Category from "discourse/models/category";
|
||||
|
@ -75,7 +76,7 @@ export function translateResults(results, opts) {
|
|||
results.tags = results.tags
|
||||
.map(function(tag) {
|
||||
const tagName = Handlebars.Utils.escapeExpression(tag.name);
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
id: tagName,
|
||||
url: Discourse.getURL("/tags/" + tagName)
|
||||
});
|
||||
|
@ -127,7 +128,7 @@ export function translateResults(results, opts) {
|
|||
!results.categories.length
|
||||
);
|
||||
|
||||
return noResults ? null : Ember.Object.create(results);
|
||||
return noResults ? null : EmberObject.create(results);
|
||||
}
|
||||
|
||||
export function searchForTerm(term, opts) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import offsetCalculator from "discourse/lib/offset-calculator";
|
||||
import LockOn from "discourse/lib/lock-on";
|
||||
import { defaultHomepage } from "discourse/lib/utilities";
|
||||
|
@ -77,7 +78,7 @@ export function jumpToElement(elementId) {
|
|||
|
||||
let _transitioning = false;
|
||||
|
||||
const DiscourseURL = Ember.Object.extend({
|
||||
const DiscourseURL = EmberObject.extend({
|
||||
isJumpScheduled() {
|
||||
return _transitioning || _jumpScheduled;
|
||||
},
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import EmberObjectProxy from "@ember/object/proxy";
|
||||
|
||||
/* global BufferedProxy: true */
|
||||
export function bufferedProperty(property) {
|
||||
const mixin = {
|
||||
buffered: Ember.computed(property, function() {
|
||||
return Ember.ObjectProxy.extend(BufferedProxy).create({
|
||||
return EmberObjectProxy.extend(BufferedProxy).create({
|
||||
content: this.get(property)
|
||||
});
|
||||
}),
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
```javascript
|
||||
|
||||
// Define your class and apply the Mixin
|
||||
User = Ember.Object.extend({});
|
||||
User = EmberObject.extend({});
|
||||
User.reopenClass(Singleton);
|
||||
|
||||
// Retrieve the current instance:
|
||||
|
@ -34,7 +34,7 @@
|
|||
```javascript
|
||||
|
||||
// Define your class and apply the Mixin
|
||||
Foot = Ember.Object.extend({});
|
||||
Foot = EmberObject.extend({});
|
||||
Foot.reopenClass(Singleton, {
|
||||
createCurrent: function() {
|
||||
return Foot.create({toes: 5});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import InputValidation from "discourse/models/input-validation";
|
||||
import {
|
||||
on,
|
||||
|
@ -14,7 +15,7 @@ export default Ember.Mixin.create({
|
|||
let userFields = this.site.get("user_fields");
|
||||
if (userFields) {
|
||||
userFields = _.sortBy(userFields, "position").map(function(f) {
|
||||
return Ember.Object.create({ value: null, field: f });
|
||||
return EmberObject.create({ value: null, field: f });
|
||||
});
|
||||
}
|
||||
this.set("userFields", userFields);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import BadgeGrouping from "discourse/models/badge-grouping";
|
||||
import RestModel from "discourse/models/rest";
|
||||
|
@ -66,7 +67,7 @@ Badge.reopenClass({
|
|||
if ("badge_types" in json) {
|
||||
json.badge_types.forEach(
|
||||
badgeTypeJson =>
|
||||
(badgeTypes[badgeTypeJson.id] = Ember.Object.create(badgeTypeJson))
|
||||
(badgeTypes[badgeTypeJson.id] = EmberObject.create(badgeTypeJson))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import Topic from "discourse/models/topic";
|
||||
import { throwAjaxError } from "discourse/lib/ajax-error";
|
||||
|
@ -215,7 +216,7 @@ const Composer = RestModel.extend({
|
|||
|
||||
@observes("archetype")
|
||||
archetypeChanged() {
|
||||
return this.set("metaData", Ember.Object.create());
|
||||
return this.set("metaData", EmberObject.create());
|
||||
},
|
||||
|
||||
// view detected user is typing
|
||||
|
@ -677,7 +678,7 @@ const Composer = RestModel.extend({
|
|||
|
||||
this.setProperties({
|
||||
archetypeId: opts.archetypeId || this.site.default_archetype,
|
||||
metaData: opts.metaData ? Ember.Object.create(opts.metaData) : null,
|
||||
metaData: opts.metaData ? EmberObject.create(opts.metaData) : null,
|
||||
reply: opts.reply || this.reply || ""
|
||||
});
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import Category from "discourse/models/category";
|
|||
import User from "discourse/models/user";
|
||||
import Topic from "discourse/models/topic";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const Group = RestModel.extend({
|
||||
limit: 50,
|
||||
|
@ -216,7 +217,7 @@ const Group = RestModel.extend({
|
|||
return ajax(`/groups/${this.name}/logs.json`, {
|
||||
data: { offset, filters }
|
||||
}).then(results => {
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
logs: results["logs"].map(log => GroupHistory.create(log)),
|
||||
all_loaded: results["all_loaded"]
|
||||
});
|
||||
|
@ -241,7 +242,7 @@ const Group = RestModel.extend({
|
|||
p.user = User.create(p.user);
|
||||
p.topic = Topic.create(p.topic);
|
||||
p.category = Category.findById(p.category_id);
|
||||
return Ember.Object.create(p);
|
||||
return EmberObject.create(p);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
|
@ -42,7 +43,7 @@ Invite.reopenClass({
|
|||
data
|
||||
}).then(result => {
|
||||
result.invites = result.invites.map(i => Invite.create(i));
|
||||
return Ember.Object.create(result);
|
||||
return EmberObject.create(result);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -50,7 +51,7 @@ Invite.reopenClass({
|
|||
if (!user) Ember.RSVP.resolve();
|
||||
|
||||
return ajax(userPath(`${user.username_lower}/invited_count.json`)).then(
|
||||
result => Ember.Object.create(result.counts)
|
||||
result => EmberObject.create(result.counts)
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { updateCsrfToken } from "discourse/lib/ajax";
|
||||
|
||||
const LoginMethod = Ember.Object.extend({
|
||||
const LoginMethod = EmberObject.extend({
|
||||
@computed
|
||||
title() {
|
||||
return this.title_override || I18n.t(`login.${this.name}.title`);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const Model = Ember.Object.extend();
|
||||
import EmberObject from "@ember/object";
|
||||
const Model = EmberObject.extend();
|
||||
|
||||
Model.reopenClass({
|
||||
extractByKey(collection, klass) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
@ -346,7 +347,7 @@ const Post = RestModel.extend({
|
|||
Post.reopenClass({
|
||||
munge(json) {
|
||||
if (json.actions_summary) {
|
||||
const lookup = Ember.Object.create();
|
||||
const lookup = EmberObject.create();
|
||||
|
||||
// this area should be optimized, it is creating way too many objects per post
|
||||
json.actions_summary = json.actions_summary.map(a => {
|
||||
|
@ -394,7 +395,7 @@ Post.reopenClass({
|
|||
|
||||
loadRevision(postId, version) {
|
||||
return ajax(`/posts/${postId}/revisions/${version}.json`).then(result =>
|
||||
Ember.Object.create(result)
|
||||
EmberObject.create(result)
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
const RestModel = Ember.Object.extend({
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const RestModel = EmberObject.extend({
|
||||
isNew: Ember.computed.equal("__state", "new"),
|
||||
isCreated: Ember.computed.equal("__state", "created"),
|
||||
isSaving: false,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import Archetype from "discourse/models/archetype";
|
||||
import PostActionType from "discourse/models/post-action-type";
|
||||
|
@ -179,7 +180,7 @@ Site.reopenClass(Singleton, {
|
|||
}
|
||||
|
||||
if (result.post_action_types) {
|
||||
result.postActionByIdLookup = Ember.Object.create();
|
||||
result.postActionByIdLookup = EmberObject.create();
|
||||
result.post_action_types = result.post_action_types.map(p => {
|
||||
const actionType = PostActionType.create(p);
|
||||
result.postActionByIdLookup.set("action" + p.id, actionType);
|
||||
|
@ -188,7 +189,7 @@ Site.reopenClass(Singleton, {
|
|||
}
|
||||
|
||||
if (result.topic_flag_types) {
|
||||
result.topicFlagByIdLookup = Ember.Object.create();
|
||||
result.topicFlagByIdLookup = EmberObject.create();
|
||||
result.topic_flag_types = result.topic_flag_types.map(p => {
|
||||
const actionType = PostActionType.create(p);
|
||||
result.topicFlagByIdLookup.set("action" + p.id, actionType);
|
||||
|
@ -204,9 +205,7 @@ Site.reopenClass(Singleton, {
|
|||
}
|
||||
|
||||
if (result.user_fields) {
|
||||
result.user_fields = result.user_fields.map(uf =>
|
||||
Ember.Object.create(uf)
|
||||
);
|
||||
result.user_fields = result.user_fields.map(uf => EmberObject.create(uf));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
const StaticPage = Ember.Object.extend();
|
||||
const StaticPage = EmberObject.extend();
|
||||
|
||||
StaticPage.reopenClass({
|
||||
find(path) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import ResultSet from "discourse/models/result-set";
|
||||
|
@ -44,7 +45,7 @@ function findAndRemoveMap(type, id) {
|
|||
|
||||
flushMap();
|
||||
|
||||
export default Ember.Object.extend({
|
||||
export default EmberObject.extend({
|
||||
_plurals: {
|
||||
"post-reply": "post-replies",
|
||||
"post-reply-history": "post_reply_histories",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
|
@ -23,7 +24,7 @@ const TopicDetails = RestModel.extend({
|
|||
if (details.participants) {
|
||||
details.participants = details.participants.map(function(p) {
|
||||
p.topic = topic;
|
||||
return Ember.Object.create(p);
|
||||
return EmberObject.create(p);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import Model from "discourse/models/model";
|
||||
|
@ -135,7 +136,7 @@ TopicList.reopenClass({
|
|||
|
||||
const categories = Discourse.Category.list(),
|
||||
users = Model.extractByKey(result.users, Discourse.User),
|
||||
groups = Model.extractByKey(result.primary_groups, Ember.Object);
|
||||
groups = Model.extractByKey(result.primary_groups, EmberObject);
|
||||
|
||||
return result.topic_list[listKey].map(t => {
|
||||
t.category = categories.findBy("id", t.category_id);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { flushMap } from "discourse/models/store";
|
||||
import RestModel from "discourse/models/rest";
|
||||
|
@ -635,7 +636,7 @@ Topic.reopenClass({
|
|||
|
||||
createActionSummary(result) {
|
||||
if (result.actions_summary) {
|
||||
const lookup = Ember.Object.create();
|
||||
const lookup = EmberObject.create();
|
||||
result.actions_summary = result.actions_summary.map(a => {
|
||||
a.post = result;
|
||||
a.actionType = Discourse.Site.current().postActionTypeById(a.id);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { url } from "discourse/lib/computed";
|
||||
import RestModel from "discourse/models/rest";
|
||||
|
@ -116,7 +117,7 @@ const User = RestModel.extend({
|
|||
const keys = this.user_api_keys;
|
||||
if (keys) {
|
||||
return keys.map(raw => {
|
||||
let obj = Ember.Object.create(raw);
|
||||
let obj = EmberObject.create(raw);
|
||||
|
||||
obj.revoke = () => {
|
||||
this.revokeApiKey(obj);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Object.extend({
|
||||
export default EmberObject.extend({
|
||||
postCountsPresent: Ember.computed.or("topic.unread", "topic.displayNewPosts"),
|
||||
showBadges: Ember.computed.and("postBadgesEnabled", "postCountsPresent"),
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
|
||||
export default Ember.Object.extend({
|
||||
export default EmberObject.extend({
|
||||
tagName: "td",
|
||||
|
||||
@computed("topic.like_count", "topic.posts_count")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Object.extend({
|
||||
export default EmberObject.extend({
|
||||
@computed
|
||||
isLastVisited: function() {
|
||||
return this.lastVisitedTopic === this.topic;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Object.extend({
|
||||
export default EmberObject.extend({
|
||||
@computed
|
||||
localizedName() {
|
||||
if (this.forceName) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Object.extend({
|
||||
export default EmberObject.extend({
|
||||
showDefault: null,
|
||||
|
||||
@computed("defaultIcon")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import OpenComposer from "discourse/mixins/open-composer";
|
||||
|
@ -51,7 +52,7 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||
wrappedCategoriesList && wrappedCategoriesList.category_list;
|
||||
|
||||
if (categoriesList && topicsList) {
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
categories: CategoryList.categoriesFrom(
|
||||
this.store,
|
||||
wrappedCategoriesList
|
||||
|
@ -66,7 +67,7 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||
}
|
||||
// Otherwise, return the ajax result
|
||||
return ajax(`/categories_and_${filter}`).then(result => {
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
categories: CategoryList.categoriesFrom(this.store, result),
|
||||
topics: TopicList.topicsFrom(this.store, result),
|
||||
can_create_category: result.category_list.can_create_category,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
@ -7,7 +8,7 @@ export default DiscourseRoute.extend({
|
|||
const username = this.modelFor("user").get("username_lower");
|
||||
return ajax(`/tags/personal_messages/${username}`)
|
||||
.then(result => {
|
||||
return result.tags.map(tag => Ember.Object.create(tag));
|
||||
return result.tags.map(tag => EmberObject.create(tag));
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import {
|
||||
default as computed,
|
||||
on,
|
||||
|
@ -7,7 +8,7 @@ import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
|
|||
|
||||
const LOGS_NOTICE_KEY = "logs-notice-text";
|
||||
|
||||
const LogsNotice = Ember.Object.extend({
|
||||
const LogsNotice = EmberObject.extend({
|
||||
text: "",
|
||||
|
||||
@on("init")
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import {
|
||||
default as computed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Object.extend({
|
||||
export default EmberObject.extend({
|
||||
searchContextEnabled: false, // checkbox to scope search
|
||||
searchContext: null,
|
||||
term: null,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
const { get, isNone, run, isEmpty, makeArray } = Ember;
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
@ -87,11 +88,11 @@ export default Component.extend(
|
|||
this.noneValue = "__none__";
|
||||
this.set(
|
||||
"headerComponentOptions",
|
||||
Ember.Object.create({ forceEscape: this.forceEscape })
|
||||
EmberObject.create({ forceEscape: this.forceEscape })
|
||||
);
|
||||
this.set(
|
||||
"rowComponentOptions",
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
forceEscape: this.forceEscape
|
||||
})
|
||||
);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import ValidState from "wizard/mixins/valid-state";
|
||||
import { ajax } from "wizard/lib/ajax";
|
||||
|
||||
export default Ember.Object.extend(ValidState, {
|
||||
export default EmberObject.extend(ValidState, {
|
||||
id: null,
|
||||
|
||||
@computed("index")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import ValidState from "wizard/mixins/valid-state";
|
||||
|
||||
export default Ember.Object.extend(ValidState, {
|
||||
export default EmberObject.extend(ValidState, {
|
||||
id: null,
|
||||
type: null,
|
||||
value: null,
|
||||
|
|
|
@ -2,8 +2,9 @@ import Step from "wizard/models/step";
|
|||
import WizardField from "wizard/models/wizard-field";
|
||||
import { ajax } from "wizard/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const Wizard = Ember.Object.extend({
|
||||
const Wizard = EmberObject.extend({
|
||||
@computed("steps.length")
|
||||
totalSteps: length => length,
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import selectKit from "helpers/select-kit-helper";
|
||||
import componentTest from "helpers/component-test";
|
||||
|
||||
|
@ -20,7 +21,7 @@ componentTest("default", {
|
|||
|
||||
this.set(
|
||||
"setting",
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
allowsNone: undefined,
|
||||
category: "foo",
|
||||
default: "",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
moduleFor("controller:preferences/account");
|
||||
|
||||
QUnit.test("updating of associated accounts", function(assert) {
|
||||
|
@ -5,11 +6,11 @@ QUnit.test("updating of associated accounts", function(assert) {
|
|||
siteSettings: {
|
||||
enable_google_oauth2_logins: true
|
||||
},
|
||||
model: Ember.Object.create({
|
||||
model: EmberObject.create({
|
||||
second_factor_enabled: true,
|
||||
is_anonymous: true
|
||||
}),
|
||||
site: Ember.Object.create({
|
||||
site: EmberObject.create({
|
||||
isMobileDevice: false
|
||||
})
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { mapRoutes } from "discourse/mapping-router";
|
||||
import createStore from "helpers/create-store";
|
||||
|
||||
|
@ -16,7 +17,7 @@ QUnit.test("fixIndices set unique position number", function(assert) {
|
|||
categories.push(store.createRecord("category", { id: i, position: 0 }));
|
||||
}
|
||||
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.fixIndices();
|
||||
|
@ -59,7 +60,7 @@ QUnit.test(
|
|||
const categories = [child2, parent, other, child1];
|
||||
const expectedOrderSlugs = ["parent", "child2", "child1", "other"];
|
||||
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.fixIndices();
|
||||
|
@ -95,7 +96,7 @@ QUnit.test(
|
|||
});
|
||||
|
||||
const categories = [elem1, elem2, elem3];
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.actions.change.call(
|
||||
|
@ -142,7 +143,7 @@ QUnit.test(
|
|||
});
|
||||
|
||||
const categories = [elem1, child1, elem2, elem3];
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.actions.change.call(
|
||||
|
@ -189,7 +190,7 @@ QUnit.test(
|
|||
});
|
||||
|
||||
const categories = [elem1, child1, elem2, elem3];
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.fixIndices();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Topic from "discourse/models/topic";
|
||||
import PostStream from "discourse/models/post-stream";
|
||||
import { Placeholder } from "discourse/lib/posts-with-placeholders";
|
||||
|
@ -191,7 +192,7 @@ QUnit.test("selectedPostsUsername", function(assert) {
|
|||
});
|
||||
|
||||
QUnit.test("showSelectedPostsAtBottom", function(assert) {
|
||||
const site = Ember.Object.create({ mobileView: false });
|
||||
const site = EmberObject.create({ mobileView: false });
|
||||
const model = Topic.create({ posts_count: 3 });
|
||||
const controller = this.subject({ model, site });
|
||||
|
||||
|
@ -467,7 +468,7 @@ QUnit.test("togglePostSelection", function(assert) {
|
|||
// });
|
||||
|
||||
QUnit.test("selectBelow", function(assert) {
|
||||
const site = Ember.Object.create({
|
||||
const site = EmberObject.create({
|
||||
post_types: { small_action: 3, whisper: 4 }
|
||||
});
|
||||
|
||||
|
@ -521,7 +522,7 @@ QUnit.test(
|
|||
});
|
||||
|
||||
let destroyed;
|
||||
const post = Ember.Object.create({
|
||||
const post = EmberObject.create({
|
||||
id: 2,
|
||||
post_number: 2,
|
||||
can_delete: true,
|
||||
|
@ -532,12 +533,12 @@ QUnit.test(
|
|||
}
|
||||
});
|
||||
|
||||
const postStream = Ember.Object.create({
|
||||
const postStream = EmberObject.create({
|
||||
stream: [2, 3, 4],
|
||||
posts: [post, { id: 3 }, { id: 4 }]
|
||||
});
|
||||
|
||||
const currentUser = Ember.Object.create({ moderator: true });
|
||||
const currentUser = EmberObject.create({ moderator: true });
|
||||
const model = Topic.create({ postStream });
|
||||
const controller = this.subject({ model, currentUser });
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import createStore from "helpers/create-store";
|
||||
import { autoLoadModules } from "discourse/initializers/auto-load-modules";
|
||||
import TopicTrackingState from "discourse/models/topic-tracking-state";
|
||||
|
@ -15,7 +16,7 @@ export default function(name, opts) {
|
|||
this.registry.register("site-settings:main", Discourse.SiteSettings, {
|
||||
instantiate: false
|
||||
});
|
||||
this.registry.register("capabilities:main", Ember.Object);
|
||||
this.registry.register("capabilities:main", EmberObject);
|
||||
this.registry.register("site:main", this.site, { instantiate: false });
|
||||
this.registry.injection("component", "siteSettings", "site-settings:main");
|
||||
this.registry.injection("component", "appEvents", "service:app-events");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import {
|
||||
setting,
|
||||
propertyEqual,
|
||||
|
@ -20,7 +21,7 @@ QUnit.module("lib:computed", {
|
|||
});
|
||||
|
||||
QUnit.test("setting", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
vehicle: setting("vehicle"),
|
||||
missingProp: setting("madeUpThing")
|
||||
}).create();
|
||||
|
@ -38,7 +39,7 @@ QUnit.test("setting", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("propertyEqual", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
same: propertyEqual("cookies", "biscuits")
|
||||
}).create({
|
||||
cookies: 10,
|
||||
|
@ -51,7 +52,7 @@ QUnit.test("propertyEqual", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("propertyNotEqual", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
diff: propertyNotEqual("cookies", "biscuits")
|
||||
}).create({
|
||||
cookies: 10,
|
||||
|
@ -64,7 +65,7 @@ QUnit.test("propertyNotEqual", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("fmt", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
exclaimyUsername: fmt("username", "!!! %@ !!!"),
|
||||
multiple: fmt("username", "mood", "%@ is %@")
|
||||
}).create({
|
||||
|
@ -98,7 +99,7 @@ QUnit.test("fmt", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("i18n", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
exclaimyUsername: i18n("username", "!!! %@ !!!"),
|
||||
multiple: i18n("username", "mood", "%@ is %@")
|
||||
}).create({
|
||||
|
@ -134,7 +135,7 @@ QUnit.test("i18n", assert => {
|
|||
QUnit.test("url", assert => {
|
||||
var t, testClass;
|
||||
|
||||
testClass = Ember.Object.extend({
|
||||
testClass = EmberObject.extend({
|
||||
userUrl: url("username", "/u/%@")
|
||||
});
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Singleton from "discourse/mixins/singleton";
|
||||
|
||||
QUnit.module("mixin:singleton");
|
||||
|
||||
QUnit.test("current", assert => {
|
||||
var DummyModel = Ember.Object.extend({});
|
||||
var DummyModel = EmberObject.extend({});
|
||||
DummyModel.reopenClass(Singleton);
|
||||
|
||||
var current = DummyModel.current();
|
||||
|
@ -21,7 +22,7 @@ QUnit.test("current", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("currentProp reading", assert => {
|
||||
var DummyModel = Ember.Object.extend({});
|
||||
var DummyModel = EmberObject.extend({});
|
||||
DummyModel.reopenClass(Singleton);
|
||||
var current = DummyModel.current();
|
||||
|
||||
|
@ -38,7 +39,7 @@ QUnit.test("currentProp reading", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("currentProp writing", assert => {
|
||||
var DummyModel = Ember.Object.extend({});
|
||||
var DummyModel = EmberObject.extend({});
|
||||
DummyModel.reopenClass(Singleton);
|
||||
|
||||
assert.blank(
|
||||
|
@ -65,7 +66,7 @@ QUnit.test("currentProp writing", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("createCurrent", assert => {
|
||||
var Shoe = Ember.Object.extend({});
|
||||
var Shoe = EmberObject.extend({});
|
||||
Shoe.reopenClass(Singleton, {
|
||||
createCurrent: function() {
|
||||
return Shoe.create({ toes: 5 });
|
||||
|
@ -80,7 +81,7 @@ QUnit.test("createCurrent", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("createCurrent that returns null", assert => {
|
||||
var Missing = Ember.Object.extend({});
|
||||
var Missing = EmberObject.extend({});
|
||||
Missing.reopenClass(Singleton, {
|
||||
createCurrent: function() {
|
||||
return null;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { currentUser } from "helpers/qunit-helpers";
|
||||
import AppEvents from "discourse/services/app-events";
|
||||
import Composer from "discourse/models/composer";
|
||||
|
@ -236,7 +237,7 @@ QUnit.test("Title length for private messages", assert => {
|
|||
|
||||
QUnit.test("Post length for private messages with non human users", assert => {
|
||||
const composer = createComposer({
|
||||
topic: Ember.Object.create({ pm_with_non_human_user: true })
|
||||
topic: EmberObject.create({ pm_with_non_human_user: true })
|
||||
});
|
||||
|
||||
assert.equal(composer.get("minimumPostLength"), 1);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Model from "discourse/models/model";
|
||||
|
||||
QUnit.module("model:discourse");
|
||||
|
@ -8,10 +9,10 @@ QUnit.test(
|
|||
var firstObject = { id: "id_1", foo: "foo_1" };
|
||||
var secondObject = { id: "id_2", foo: "foo_2" };
|
||||
|
||||
var actual = Model.extractByKey([firstObject, secondObject], Ember.Object);
|
||||
var actual = Model.extractByKey([firstObject, secondObject], EmberObject);
|
||||
var expected = {
|
||||
id_1: Ember.Object.create(firstObject),
|
||||
id_2: Ember.Object.create(secondObject)
|
||||
id_1: EmberObject.create(firstObject),
|
||||
id_2: EmberObject.create(secondObject)
|
||||
};
|
||||
|
||||
assert.ok(_.isEqual(actual, expected));
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { IMAGE_VERSION as v } from "pretty-text/emoji/version";
|
||||
|
||||
QUnit.module("model:topic");
|
||||
|
@ -33,7 +34,7 @@ QUnit.test("visited", assert => {
|
|||
});
|
||||
|
||||
QUnit.test("lastUnreadUrl", assert => {
|
||||
const category = Ember.Object.create({
|
||||
const category = EmberObject.create({
|
||||
navigate_to_first_post_after_read: true
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
||||
|
||||
moduleForWidget("post");
|
||||
|
@ -861,7 +862,7 @@ widgetTest("pm map", {
|
|||
showTopicMap: true,
|
||||
showPMMap: true,
|
||||
allowedGroups: [],
|
||||
allowedUsers: [Ember.Object.create({ username: "eviltrout" })]
|
||||
allowedUsers: [EmberObject.create({ username: "eviltrout" })]
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
|
|
Loading…
Reference in New Issue