DEV: s/Em/Ember (#6874)

This commit is contained in:
Joffrey JAFFEUX 2019-01-11 17:54:23 +01:00 committed by GitHub
parent dbe42068a2
commit 1a3655b787
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
125 changed files with 315 additions and 306 deletions

View File

@ -28,7 +28,6 @@
"currentURL": true, "currentURL": true,
"define": true, "define": true,
"Discourse": true, "Discourse": true,
"Em": true,
"Ember": true, "Ember": true,
"exists": true, "exists": true,
"expandSelectKit": true, "expandSelectKit": true,

View File

@ -34,7 +34,7 @@ export default Ember.Component.extend({
didInsertElement() { didInsertElement() {
loadScript("/javascripts/spectrum.js").then(() => { loadScript("/javascripts/spectrum.js").then(() => {
loadCSS("/javascripts/spectrum.css").then(() => { loadCSS("/javascripts/spectrum.css").then(() => {
Em.run.schedule("afterRender", () => { Ember.run.schedule("afterRender", () => {
this.$(".picker") this.$(".picker")
.spectrum({ color: "#" + this.get("hexValue") }) .spectrum({ color: "#" + this.get("hexValue") })
.on("change.spectrum", (me, color) => { .on("change.spectrum", (me, color) => {
@ -44,7 +44,7 @@ export default Ember.Component.extend({
}); });
}); });
}); });
Em.run.schedule("afterRender", () => { Ember.run.schedule("afterRender", () => {
this.hexValueChanged(); this.hexValueChanged();
}); });
} }

View File

@ -21,7 +21,7 @@ export default Ember.Component.extend({
ajax("/admin/users/ip-info", { ajax("/admin/users/ip-info", {
data: { ip: this.get("ip") } data: { ip: this.get("ip") }
}).then(function(location) { }).then(function(location) {
self.set("location", Em.Object.create(location)); self.set("location", Ember.Object.create(location));
}); });
} }

View File

@ -34,7 +34,7 @@ export default Ember.Component.extend({
self.set("permalink_type_value", ""); self.set("permalink_type_value", "");
self.set("formSubmitted", false); self.set("formSubmitted", false);
self.action(Permalink.create(result.permalink)); self.action(Permalink.create(result.permalink));
Em.run.schedule("afterRender", function() { Ember.run.schedule("afterRender", function() {
self.$(".permalink-url").focus(); self.$(".permalink-url").focus();
}); });
}, },
@ -60,7 +60,7 @@ export default Ember.Component.extend({
didInsertElement: function() { didInsertElement: function() {
var self = this; var self = this;
self._super(); self._super();
Em.run.schedule("afterRender", function() { Ember.run.schedule("afterRender", function() {
self.$(".external-url").keydown(function(e) { self.$(".external-url").keydown(function(e) {
if (e.keyCode === 13) { if (e.keyCode === 13) {
// enter key // enter key

View File

@ -55,7 +55,7 @@ export default Ember.Component.extend(
if (this.get("isUploading")) { if (this.get("isUploading")) {
this.resumable.cancel(); this.resumable.cancel();
var self = this; var self = this;
Em.run.later(function() { Ember.run.later(function() {
self._reset(); self._reset();
}); });
return false; return false;
@ -83,20 +83,20 @@ export default Ember.Component.extend(
// automatically upload the selected file // automatically upload the selected file
self.resumable.upload(); self.resumable.upload();
// mark as uploading // mark as uploading
Em.run.later(function() { Ember.run.later(function() {
self.set("isUploading", true); self.set("isUploading", true);
}); });
}); });
this.resumable.on("fileProgress", function(file) { this.resumable.on("fileProgress", function(file) {
// update progress // update progress
Em.run.later(function() { Ember.run.later(function() {
self.set("progress", parseInt(file.progress() * 100, 10)); self.set("progress", parseInt(file.progress() * 100, 10));
}); });
}); });
this.resumable.on("fileSuccess", function(file) { this.resumable.on("fileSuccess", function(file) {
Em.run.later(function() { Ember.run.later(function() {
// mark as not uploading anymore // mark as not uploading anymore
self._reset(); self._reset();
// fire an event to allow the parent route to reload its model // fire an event to allow the parent route to reload its model
@ -105,7 +105,7 @@ export default Ember.Component.extend(
}); });
this.resumable.on("fileError", function(file, message) { this.resumable.on("fileError", function(file, message) {
Em.run.later(function() { Ember.run.later(function() {
// mark as not uploading anymore // mark as not uploading anymore
self._reset(); self._reset();
// fire an event to allow the parent route to display the error message // fire an event to allow the parent route to display the error message
@ -116,7 +116,7 @@ export default Ember.Component.extend(
_assignBrowse: function() { _assignBrowse: function() {
var self = this; var self = this;
Em.run.schedule("afterRender", function() { Ember.run.schedule("afterRender", function() {
self.resumable.assignBrowse(self.$()); self.resumable.assignBrowse(self.$());
}); });
}.on("didInsertElement"), }.on("didInsertElement"),

View File

@ -1,9 +1,9 @@
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Ember.Component.extend(UploadMixin, {
type: "csv", type: "csv",
uploadUrl: "/tags/upload", uploadUrl: "/tags/upload",
addDisabled: Em.computed.alias("uploading"), addDisabled: Ember.computed.alias("uploading"),
elementId: "tag-uploader", elementId: "tag-uploader",
validateUploadedFilesOptions() { validateUploadedFilesOptions() {

View File

@ -9,9 +9,9 @@ export default Ember.Component.extend({
childrenExpanded: false, childrenExpanded: false,
classNames: ["themes-list-item"], classNames: ["themes-list-item"],
classNameBindings: ["theme.selected:selected"], classNameBindings: ["theme.selected:selected"],
hasComponents: Em.computed.gt("children.length", 0), hasComponents: Ember.computed.gt("children.length", 0),
displayComponents: Em.computed.and("hasComponents", "theme.isActive"), displayComponents: Ember.computed.and("hasComponents", "theme.isActive"),
displayHasMore: Em.computed.gt("theme.childThemes.length", MAX_COMPONENTS), displayHasMore: Ember.computed.gt("theme.childThemes.length", MAX_COMPONENTS),
click(e) { click(e) {
if (!$(e.target).hasClass("others-count")) { if (!$(e.target).hasClass("others-count")) {

View File

@ -7,12 +7,12 @@ export default Ember.Component.extend({
classNames: ["themes-list"], classNames: ["themes-list"],
hasThemes: Em.computed.gt("themesList.length", 0), hasThemes: Ember.computed.gt("themesList.length", 0),
hasUserThemes: Em.computed.gt("userThemes.length", 0), hasUserThemes: Ember.computed.gt("userThemes.length", 0),
hasInactiveThemes: Em.computed.gt("inactiveThemes.length", 0), hasInactiveThemes: Ember.computed.gt("inactiveThemes.length", 0),
themesTabActive: Em.computed.equal("currentTab", THEMES), themesTabActive: Ember.computed.equal("currentTab", THEMES),
componentsTabActive: Em.computed.equal("currentTab", COMPONENTS), componentsTabActive: Ember.computed.equal("currentTab", COMPONENTS),
@computed("themes", "components", "currentTab") @computed("themes", "components", "currentTab")
themesList(themes, components) { themesList(themes, components) {
@ -79,7 +79,7 @@ export default Ember.Component.extend({
} }
}, },
navigateToTheme(theme) { navigateToTheme(theme) {
Em.getOwner(this) Ember.getOwner(this)
.lookup("router:main") .lookup("router:main")
.transitionTo("adminCustomizeThemes.show", theme); .transitionTo("adminCustomizeThemes.show", theme);
} }

View File

@ -1,11 +1,11 @@
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Ember.Component.extend(UploadMixin, {
type: "csv", type: "csv",
classNames: "watched-words-uploader", classNames: "watched-words-uploader",
uploadUrl: "/admin/logs/watched_words/upload", uploadUrl: "/admin/logs/watched_words/upload",
addDisabled: Em.computed.alias("uploading"), addDisabled: Ember.computed.alias("uploading"),
validateUploadedFilesOptions() { validateUploadedFilesOptions() {
return { csvOnly: true }; return { csvOnly: true };

View File

@ -1,5 +1,5 @@
export default Ember.Controller.extend({ export default Ember.Controller.extend({
logs: [], logs: [],
adminBackups: Ember.inject.controller(), adminBackups: Ember.inject.controller(),
status: Em.computed.alias("adminBackups.model") status: Ember.computed.alias("adminBackups.model")
}); });

View File

@ -51,7 +51,7 @@ export default Ember.Controller.extend({
}, },
copy() { copy() {
var newColorScheme = Em.copy(this.get("model"), true); var newColorScheme = Ember.copy(this.get("model"), true);
newColorScheme.set( newColorScheme.set(
"name", "name",
I18n.t("admin.customize.colors.copy_name_prefix") + I18n.t("admin.customize.colors.copy_name_prefix") +

View File

@ -10,7 +10,7 @@ export default Ember.Controller.extend({
}.property("model.@each.id"), }.property("model.@each.id"),
baseColors: function() { baseColors: function() {
var baseColorsHash = Em.Object.create({}); var baseColorsHash = Ember.Object.create({});
this.get("baseColorScheme.colors").forEach(color => { this.get("baseColorScheme.colors").forEach(color => {
baseColorsHash.set(color.get("name"), color); baseColorsHash.set(color.get("name"), color);
}); });
@ -23,7 +23,7 @@ export default Ember.Controller.extend({
"base_scheme_id", "base_scheme_id",
baseKey baseKey
); );
const newColorScheme = Em.copy(base, true); const newColorScheme = Ember.copy(base, true);
newColorScheme.set("name", I18n.t("admin.customize.colors.new_name")); newColorScheme.set("name", I18n.t("admin.customize.colors.new_name"));
newColorScheme.set("base_scheme_id", base.get("base_scheme_id")); newColorScheme.set("base_scheme_id", base.get("base_scheme_id"));
newColorScheme.save().then(() => { newColorScheme.save().then(() => {

View File

@ -179,7 +179,7 @@ export default Ember.Controller.extend({
toggleMaximize: function() { toggleMaximize: function() {
this.toggleProperty("maximized"); this.toggleProperty("maximized");
Em.run.next(() => { Ember.run.next(() => {
this.appEvents.trigger("ace:resize"); this.appEvents.trigger("ace:resize");
}); });
} }

View File

@ -10,7 +10,7 @@ const THEME_UPLOAD_VAR = 2;
export default Ember.Controller.extend({ export default Ember.Controller.extend({
downloadUrl: url("model.id", "/admin/themes/%@"), downloadUrl: url("model.id", "/admin/themes/%@"),
previewUrl: url("model.id", "/admin/themes/%@/preview"), previewUrl: url("model.id", "/admin/themes/%@/preview"),
addButtonDisabled: Em.computed.empty("selectedChildThemeId"), addButtonDisabled: Ember.computed.empty("selectedChildThemeId"),
editRouteName: "adminCustomizeThemes.edit", editRouteName: "adminCustomizeThemes.edit",
@computed("model", "allThemes", "model.component") @computed("model", "allThemes", "model.component")

View File

@ -5,7 +5,7 @@ export default Ember.Controller.extend({
@property sendTestEmailDisabled @property sendTestEmailDisabled
**/ **/
sendTestEmailDisabled: Em.computed.empty("testEmailAddress"), sendTestEmailDisabled: Ember.computed.empty("testEmailAddress"),
/** /**
Clears the 'sentTestEmail' property on successful send. Clears the 'sentTestEmail' property on successful send.

View File

@ -4,7 +4,7 @@ const MAX_FIELDS = 20;
export default Ember.Controller.extend({ export default Ember.Controller.extend({
fieldTypes: null, fieldTypes: null,
createDisabled: Em.computed.gte("model.length", MAX_FIELDS), createDisabled: Ember.computed.gte("model.length", MAX_FIELDS),
fieldSortOrder: ["position"], fieldSortOrder: ["position"],
sortedFields: Ember.computed.sort("model", "fieldSortOrder"), sortedFields: Ember.computed.sort("model", "fieldSortOrder"),

View File

@ -14,15 +14,15 @@ export default Ember.Controller.extend(CanCheckEmails, {
listFilter: null, listFilter: null,
selectAll: false, selectAll: false,
queryNew: Em.computed.equal("query", "new"), queryNew: Ember.computed.equal("query", "new"),
queryPending: Em.computed.equal("query", "pending"), queryPending: Ember.computed.equal("query", "pending"),
queryHasApproval: Em.computed.or("queryNew", "queryPending"), queryHasApproval: Ember.computed.or("queryNew", "queryPending"),
showApproval: Em.computed.and( showApproval: Ember.computed.and(
"siteSettings.must_approve_users", "siteSettings.must_approve_users",
"queryHasApproval" "queryHasApproval"
), ),
searchHint: i18n("search_hint"), searchHint: i18n("search_hint"),
hasSelection: Em.computed.gt("selectedCount", 0), hasSelection: Ember.computed.gt("selectedCount", 0),
selectedCount: function() { selectedCount: function() {
var model = this.get("model"); var model = this.get("model");

View File

@ -43,7 +43,7 @@ export default Ember.Controller.extend({
if (a) { if (a) {
a.words.unshiftObject(arg); a.words.unshiftObject(arg);
a.incrementProperty("count"); a.incrementProperty("count");
Em.run.schedule("afterRender", () => { Ember.run.schedule("afterRender", () => {
// remove from other actions lists // remove from other actions lists
let match = null; let match = null;
this.get("adminWatchedWords.model").forEach(action => { this.get("adminWatchedWords.model").forEach(action => {

View File

@ -63,8 +63,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
this.set("fileSelected", false); this.set("fileSelected", false);
}, },
enabled: Em.computed.and("nameValid", "fileSelected"), enabled: Ember.computed.and("nameValid", "fileSelected"),
disabled: Em.computed.not("enabled"), disabled: Ember.computed.not("enabled"),
@computed("name", "adminCustomizeThemesShow.model.theme_fields") @computed("name", "adminCustomizeThemesShow.model.theme_fields")
errorMessage(name, themeFields) { errorMessage(name, themeFields) {
@ -105,7 +105,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
actions: { actions: {
updateName() { updateName() {
let name = this.get("name"); let name = this.get("name");
if (Em.isEmpty(name)) { if (Ember.isEmpty(name)) {
name = $("#file-input")[0].files[0].name; name = $("#file-input")[0].files[0].name;
this.set("name", name.split(".")[0]); this.set("name", name.split(".")[0]);
} }

View File

@ -4,7 +4,7 @@ import ModalFunctionality from "discourse/mixins/modal-functionality";
export default Ember.Controller.extend(ModalFunctionality, { export default Ember.Controller.extend(ModalFunctionality, {
modelChanged: function() { modelChanged: function() {
const model = this.get("model"); const model = this.get("model");
const copy = Em.A(); const copy = Ember.A();
const store = this.store; const store = this.store;
if (model) { if (model) {

View File

@ -100,7 +100,7 @@ export default Ember.Mixin.create({
}.on("willDestroyElement"), }.on("willDestroyElement"),
_save() { _save() {
Em.warn("You should define a `_save` method", { Ember.warn("You should define a `_save` method", {
id: "admin.mixins.setting-component" id: "admin.mixins.setting-component"
}); });
return Ember.RSVP.resolve(); return Ember.RSVP.resolve();

View File

@ -305,7 +305,7 @@ const AdminUser = Discourse.User.extend({
return this.get("trust_level") < 4; return this.get("trust_level") < 4;
}.property("trust_level"), }.property("trust_level"),
canSuspend: Em.computed.not("staff"), canSuspend: Ember.computed.not("staff"),
suspendDuration: function() { suspendDuration: function() {
const suspended_at = moment(this.suspended_at), const suspended_at = moment(this.suspended_at),

View File

@ -1,7 +1,7 @@
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
export default Discourse.Model.extend({ export default Discourse.Model.extend({
restoreDisabled: Em.computed.not("restoreEnabled"), restoreDisabled: Ember.computed.not("restoreEnabled"),
@computed("allowRestore", "isOperationRunning") @computed("allowRestore", "isOperationRunning")
restoreEnabled(allowRestore, isOperationRunning) { restoreEnabled(allowRestore, isOperationRunning) {

View File

@ -30,7 +30,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
var newScheme = ColorScheme.create({ var newScheme = ColorScheme.create({
name: this.get("name"), name: this.get("name"),
can_edit: true, can_edit: true,
colors: Em.A() colors: Ember.A()
}); });
this.get("colors").forEach(c => { this.get("colors").forEach(c => {
newScheme.colors.pushObject( newScheme.colors.pushObject(

View File

@ -10,9 +10,9 @@ const SETTINGS_TYPE_ID = 5;
const Theme = RestModel.extend({ const Theme = RestModel.extend({
FIELDS_IDS: [0, 1], FIELDS_IDS: [0, 1],
isActive: Em.computed.or("default", "user_selectable"), isActive: Ember.computed.or("default", "user_selectable"),
isPendingUpdates: Em.computed.gt("remote_theme.commits_behind", 0), isPendingUpdates: Ember.computed.gt("remote_theme.commits_behind", 0),
hasEditedFields: Em.computed.gt("editedFields.length", 0), hasEditedFields: Ember.computed.gt("editedFields.length", 0),
@computed("theme_fields") @computed("theme_fields")
themeFields(fields) { themeFields(fields) {
@ -50,7 +50,7 @@ const Theme = RestModel.extend({
@computed("theme_fields.[]") @computed("theme_fields.[]")
editedFields(fields) { editedFields(fields) {
return fields.filter( return fields.filter(
field => !Em.isBlank(field.value) && field.type_id !== SETTINGS_TYPE_ID field => !Ember.isBlank(field.value) && field.type_id !== SETTINGS_TYPE_ID
); );
}, },
@ -67,11 +67,11 @@ const Theme = RestModel.extend({
hasEdited(target, name) { hasEdited(target, name) {
if (name) { if (name) {
return !Em.isEmpty(this.getField(target, name)); return !Ember.isEmpty(this.getField(target, name));
} else { } else {
let fields = this.get("theme_fields") || []; let fields = this.get("theme_fields") || [];
return fields.any( return fields.any(
field => field.target === target && !Em.isEmpty(field.value) field => field.target === target && !Ember.isEmpty(field.value)
); );
} }
}, },

View File

@ -15,7 +15,7 @@ export default Ember.Route.extend({
return log.message.length === 0 || log.message[0] === "["; return log.message.length === 0 || log.message[0] === "[";
}) })
.map(function(log) { .map(function(log) {
return Em.Object.create(log); return Ember.Object.create(log);
}) })
.value(); .value();
logs.pushObjects(newLogs); logs.pushObjects(newLogs);

View File

@ -41,7 +41,7 @@ export default Discourse.Route.extend({
} else { } else {
this.controllerFor("adminBackupsLogs") this.controllerFor("adminBackupsLogs")
.get("logs") .get("logs")
.pushObject(Em.Object.create(log)); .pushObject(Ember.Object.create(log));
} }
}); });
}, },

View File

@ -4,7 +4,7 @@ import showModal from "discourse/lib/show-modal";
export default Ember.Route.extend({ export default Ember.Route.extend({
serialize(m) { serialize(m) {
return { badge_id: Em.get(m, "id") || "new" }; return { badge_id: Ember.get(m, "id") || "new" };
}, },
model(params) { model(params) {
@ -49,7 +49,7 @@ export default Ember.Route.extend({
}) })
.catch(function(error) { .catch(function(error) {
badge.set("preview_loading", false); badge.set("preview_loading", false);
Em.Logger.error(error); Ember.Logger.error(error);
bootbox.alert("Network error"); bootbox.alert("Network error");
}); });
} }

View File

@ -9,7 +9,7 @@ export default Discourse.Route.extend({
}, },
model(params) { model(params) {
return AdminUser.find(Em.get(params, "user_id")); return AdminUser.find(Ember.get(params, "user_id"));
}, },
renderTemplate() { renderTemplate() {

View File

@ -7,7 +7,7 @@
require("discourse/routes/application").default.reopen({ require("discourse/routes/application").default.reopen({
actions: { actions: {
didTransition: function() { didTransition: function() {
Em.run.next(function() { Ember.run.next(function() {
Discourse.authenticationComplete(authenticationData); Discourse.authenticationComplete(authenticationData);
}); });
return this._super(); return this._super();

View File

@ -24,7 +24,7 @@ RawHandlebars.helpers["get"] = function(context, options) {
context = context.slice(context.indexOf(".") + 1); context = context.slice(context.indexOf(".") + 1);
} }
return val === undefined ? Em.get(firstContext, context) : val; return val === undefined ? Ember.get(firstContext, context) : val;
}; };
// adds compatability so this works with stringParams // adds compatability so this works with stringParams
@ -45,7 +45,7 @@ RawHandlebars.registerHelper("each", function(
contextName, contextName,
options options
) { ) {
var list = Em.get(this, contextName); var list = Ember.get(this, contextName);
var output = []; var output = [];
var innerContext = objectCreate(this); var innerContext = objectCreate(this);
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {

View File

@ -1,7 +1,7 @@
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Ember.Component.extend(UploadMixin, {
type: "avatar", type: "avatar",
tagName: "span", tagName: "span",
imageIsNotASquare: false, imageIsNotASquare: false,

View File

@ -2,7 +2,7 @@ import { ajax } from "discourse/lib/ajax";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Ember.Component.extend(UploadMixin, {
tagName: "span", tagName: "span",
@computed("uploading", "uploadProgress") @computed("uploading", "uploadProgress")

View File

@ -9,5 +9,5 @@ export default Ember.Component.extend({
return $("<div>" + this.get("badge.description") + "</div>").text(); return $("<div>" + this.get("badge.description") + "</div>").text();
}.property("badge.description"), }.property("badge.description"),
attributeBindings: ["data-badge-name", "title"], attributeBindings: ["data-badge-name", "title"],
"data-badge-name": Em.computed.alias("badge.name") "data-badge-name": Ember.computed.alias("badge.name")
}); });

View File

@ -2,9 +2,9 @@
export default Ember.Component.extend({ export default Ember.Component.extend({
classNameBindings: ["hidden:hidden", ":category-breadcrumb"], classNameBindings: ["hidden:hidden", ":category-breadcrumb"],
tagName: "ol", tagName: "ol",
parentCategory: Em.computed.alias("category.parentCategory"), parentCategory: Ember.computed.alias("category.parentCategory"),
parentCategories: Em.computed.filter("categories", function(c) { parentCategories: Ember.computed.filter("categories", function(c) {
if ( if (
c.id === this.site.get("uncategorized_category_id") && c.id === this.site.get("uncategorized_category_id") &&
!this.siteSettings.allow_uncategorized_topics !this.siteSettings.allow_uncategorized_topics

View File

@ -29,7 +29,7 @@ export default Ember.Component.extend({
search: debounce(function(title) { search: debounce(function(title) {
const currentTopicId = this.get("currentTopicId"); const currentTopicId = this.get("currentTopicId");
if (Em.isEmpty(title)) { if (Ember.isEmpty(title)) {
this.setProperties({ messages: null, loading: false }); this.setProperties({ messages: null, loading: false });
return; return;
} }
@ -53,7 +53,7 @@ export default Ember.Component.extend({
actions: { actions: {
chooseMessage(message) { chooseMessage(message) {
const messageId = Em.get(message, "id"); const messageId = Ember.get(message, "id");
this.set("selectedTopicId", messageId); this.set("selectedTopicId", messageId);
Ember.run.next(() => Ember.run.next(() =>
$(`#choose-message-${messageId}`).prop("checked", "true") $(`#choose-message-${messageId}`).prop("checked", "true")

View File

@ -27,7 +27,7 @@ export default Ember.Component.extend({
const self = this, const self = this,
currentTopicId = this.get("currentTopicId"); currentTopicId = this.get("currentTopicId");
if (Em.isEmpty(title)) { if (Ember.isEmpty(title)) {
self.setProperties({ topics: null, loading: false }); self.setProperties({ topics: null, loading: false });
return; return;
} }
@ -50,7 +50,7 @@ export default Ember.Component.extend({
actions: { actions: {
chooseTopic(topic) { chooseTopic(topic) {
const topicId = Em.get(topic, "id"); const topicId = Ember.get(topic, "id");
this.set("selectedTopicId", topicId); this.set("selectedTopicId", topicId);
Ember.run.next(() => Ember.run.next(() =>
$("#choose-topic-" + topicId).prop("checked", "true") $("#choose-topic-" + topicId).prop("checked", "true")

View File

@ -583,7 +583,7 @@ export default Ember.Component.extend({
if (found.indexOf(name) === -1) { if (found.indexOf(name) === -1) {
// add a delay to allow for typing, so you don't open the warning right away // add a delay to allow for typing, so you don't open the warning right away
// previously we would warn after @bob even if you were about to mention @bob2 // previously we would warn after @bob even if you were about to mention @bob2
Em.run.later( Ember.run.later(
this, this,
() => { () => {
if ( if (

View File

@ -79,7 +79,7 @@ export default Ember.Component.extend({
} }
if (Ember.testing) { if (Ember.testing) {
Em.run.next(() => Ember.run.next(() =>
// not ideal but we don't want to run this in current // not ideal but we don't want to run this in current
// runloop to avoid an error in console // runloop to avoid an error in console
this._checkForUrl() this._checkForUrl()

View File

@ -11,7 +11,7 @@ const CookText = Ember.Component.extend({
this.set("cooked", cooked); this.set("cooked", cooked);
// no choice but to defer this cause // no choice but to defer this cause
// pretty text may only be loaded now // pretty text may only be loaded now
Em.run.next(() => Ember.run.next(() =>
window window
.requireModule("pretty-text/image-short-url") .requireModule("pretty-text/image-short-url")
.resolveAllShortUrls(ajax) .resolveAllShortUrls(ajax)

View File

@ -1,7 +1,7 @@
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Ember.Component.extend(UploadMixin, {
type: "csv", type: "csv",
tagName: "span", tagName: "span",
uploadUrl: "/invites/upload_csv", uploadUrl: "/invites/upload_csv",

View File

@ -23,7 +23,7 @@ export default Ember.Component.extend({
setUp() { setUp() {
$("html").on("keydown.discourse-modal", e => { $("html").on("keydown.discourse-modal", e => {
if (e.which === 27 && this.get("dismissable")) { if (e.which === 27 && this.get("dismissable")) {
Em.run.next(() => $(".modal-header a.close").click()); Ember.run.next(() => $(".modal-header a.close").click());
} }
}); });

View File

@ -6,7 +6,9 @@ import computed from "ember-addons/ember-computed-decorators";
export default buildCategoryPanel("general", { export default buildCategoryPanel("general", {
foregroundColors: ["FFFFFF", "000000"], foregroundColors: ["FFFFFF", "000000"],
canSelectParentCategory: Em.computed.not("category.isUncategorizedCategory"), canSelectParentCategory: Ember.computed.not(
"category.isUncategorizedCategory"
),
// background colors are available as a pipe-separated string // background colors are available as a pipe-separated string
@computed @computed

View File

@ -5,12 +5,12 @@ import computed from "ember-addons/ember-computed-decorators";
export default buildCategoryPanel("settings", { export default buildCategoryPanel("settings", {
emailInEnabled: setting("email_in"), emailInEnabled: setting("email_in"),
showPositionInput: setting("fixed_category_positions"), showPositionInput: setting("fixed_category_positions"),
isParentCategory: Em.computed.empty("category.parent_category_id"), isParentCategory: Ember.computed.empty("category.parent_category_id"),
showSubcategoryListStyle: Em.computed.and( showSubcategoryListStyle: Ember.computed.and(
"category.show_subcategory_list", "category.show_subcategory_list",
"isParentCategory" "isParentCategory"
), ),
isDefaultSortOrder: Em.computed.empty("category.sort_order"), isDefaultSortOrder: Ember.computed.empty("category.sort_order"),
@computed @computed
availableSubcategoryListStyles() { availableSubcategoryListStyles() {

View File

@ -1,6 +1,6 @@
import { propertyEqual } from "discourse/lib/computed"; import { propertyEqual } from "discourse/lib/computed";
export default Em.Component.extend({ export default Ember.Component.extend({
tagName: "li", tagName: "li",
classNameBindings: ["active", "tabClassName"], classNameBindings: ["active", "tabClassName"],

View File

@ -1,11 +1,11 @@
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Ember.Component.extend(UploadMixin, {
type: "emoji", type: "emoji",
uploadUrl: "/admin/customize/emojis", uploadUrl: "/admin/customize/emojis",
hasName: Em.computed.notEmpty("name"), hasName: Ember.computed.notEmpty("name"),
addDisabled: Em.computed.not("hasName"), addDisabled: Ember.computed.not("hasName"),
data: function() { data: function() {
return Ember.isBlank(this.get("name")) ? {} : { name: this.get("name") }; return Ember.isBlank(this.get("name")) ? {} : { name: this.get("name") };

View File

@ -23,9 +23,9 @@ export default Ember.Component.extend({
return flag === selectedFlag; return flag === selectedFlag;
}, },
showMessageInput: Em.computed.and("flag.is_custom_flag", "selected"), showMessageInput: Ember.computed.and("flag.is_custom_flag", "selected"),
showDescription: Em.computed.not("showMessageInput"), showDescription: Ember.computed.not("showMessageInput"),
isNotifyUser: Em.computed.equal("flag.name_key", "notify_user"), isNotifyUser: Ember.computed.equal("flag.name_key", "notify_user"),
@computed("flag.description", "flag.short_description") @computed("flag.description", "flag.short_description")
description(long_description, short_description) { description(long_description, short_description) {

View File

@ -28,7 +28,7 @@ export default Ember.Component.extend({
return !usernames || !(usernames.length > 0); return !usernames || !(usernames.length > 0);
}, },
showingFirst: Em.computed.lte("currentPage", 1), showingFirst: Ember.computed.lte("currentPage", 1),
showingLast: propertyEqual("currentPage", "totalPages"), showingLast: propertyEqual("currentPage", "totalPages"),
actions: { actions: {
@ -60,7 +60,7 @@ export default Ember.Component.extend({
}, },
addMembers() { addMembers() {
if (Em.isEmpty(this.get("model.usernames"))) { if (Ember.isEmpty(this.get("model.usernames"))) {
return; return;
} }
this.get("model") this.get("model")

View File

@ -1,12 +1,12 @@
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Ember.Component.extend(UploadMixin, {
classNames: ["image-uploader"], classNames: ["image-uploader"],
@computed("imageUrl") @computed("imageUrl")
backgroundStyle(imageUrl) { backgroundStyle(imageUrl) {
if (Em.isEmpty(imageUrl)) { if (Ember.isEmpty(imageUrl)) {
return "".htmlSafe(); return "".htmlSafe();
} }

View File

@ -1,7 +1,7 @@
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Ember.Component.extend(UploadMixin, {
type: "avatar", type: "avatar",
tagName: "span", tagName: "span",

View File

@ -6,8 +6,8 @@ export default Ember.Component.extend(
classNameBindings: [":tip", "good", "bad"], classNameBindings: [":tip", "good", "bad"],
rerenderTriggers: ["validation"], rerenderTriggers: ["validation"],
bad: Em.computed.alias("validation.failed"), bad: Ember.computed.alias("validation.failed"),
good: Em.computed.not("bad"), good: Ember.computed.not("bad"),
buildBuffer(buffer) { buildBuffer(buffer) {
const reason = this.get("validation.reason"); const reason = this.get("validation.reason");

View File

@ -20,7 +20,7 @@ export default Ember.Component.extend({
@observes("currentPath") @observes("currentPath")
currentPathChanged() { currentPathChanged() {
this.set("expanded", false); this.set("expanded", false);
Em.run.next(() => this._updateSelectedHtml()); Ember.run.next(() => this._updateSelectedHtml());
}, },
_updateSelectedHtml() { _updateSelectedHtml() {
@ -38,7 +38,7 @@ export default Ember.Component.extend({
toggleExpanded() { toggleExpanded() {
this.toggleProperty("expanded"); this.toggleProperty("expanded");
Em.run.next(() => { Ember.run.next(() => {
if (this.get("expanded")) { if (this.get("expanded")) {
$(window) $(window)
.off("click.mobile-nav") .off("click.mobile-nav")

View File

@ -68,7 +68,7 @@ export default Ember.Component.extend({
if (this.get("expanded")) { if (this.get("expanded")) {
DiscourseURL.appEvents.on("dom:clean", this, this.ensureDropClosed); DiscourseURL.appEvents.on("dom:clean", this, this.ensureDropClosed);
Em.run.next(() => { Ember.run.next(() => {
if (!this.get("expanded")) { if (!this.get("expanded")) {
return; return;
} }

View File

@ -1,4 +1,4 @@
export default Em.Component.extend({ export default Ember.Component.extend({
classNames: ["controls"], classNames: ["controls"],
label: function() { label: function() {

View File

@ -28,7 +28,7 @@ const REGEXP_POST_TIME_WHEN = /^(before|after)/gi;
const IN_OPTIONS_MAPPING = { images: "with" }; const IN_OPTIONS_MAPPING = { images: "with" };
export default Em.Component.extend({ export default Ember.Component.extend({
classNames: ["search-advanced-options"], classNames: ["search-advanced-options"],
inOptionsForUsers: [ inOptionsForUsers: [

View File

@ -9,7 +9,10 @@ export default Ember.Component.extend({
hideForSession() { hideForSession() {
this.session.set("hideSignupCta", true); this.session.set("hideSignupCta", true);
this.keyValueStore.setItem("anon-cta-hidden", new Date().getTime()); this.keyValueStore.setItem("anon-cta-hidden", new Date().getTime());
Em.run.later(() => this.session.set("showSignupCta", false), 20 * 1000); Ember.run.later(
() => this.session.set("showSignupCta", false),
20 * 1000
);
} }
}, },

View File

@ -32,7 +32,7 @@ export default Ember.Component.extend({
if ( if (
category && category &&
Em.get(category, "id") === Ember.get(category, "id") ===
Discourse.Site.currentProp("uncategorized_category_id") Discourse.Site.currentProp("uncategorized_category_id")
) { ) {
category = null; category = null;

View File

@ -39,7 +39,7 @@ export default Ember.Component.extend(
"topic.visited" "topic.visited"
], ],
attributeBindings: ["data-topic-id"], attributeBindings: ["data-topic-id"],
"data-topic-id": Em.computed.alias("topic.id"), "data-topic-id": Ember.computed.alias("topic.id"),
@computed @computed
newDotText() { newDotText() {

View File

@ -86,7 +86,7 @@ export default MountWidget.extend(Docking, {
this._super(); this._super();
if (this.get("fullscreen") && !this.get("addShowClass")) { if (this.get("fullscreen") && !this.get("addShowClass")) {
Em.run.next(() => { Ember.run.next(() => {
this.set("addShowClass", true); this.set("addShowClass", true);
this.queueRerender(); this.queueRerender();
}); });

View File

@ -77,7 +77,7 @@ export default Ember.Component.extend(
willDestroyElement() { willDestroyElement() {
if (this._delayedRerender) { if (this._delayedRerender) {
Em.run.cancel(this._delayedRerender); Ember.run.cancel(this._delayedRerender);
} }
}, },

View File

@ -15,10 +15,10 @@ export default Ember.Component.extend({
return userPath(username); return userPath(username);
}, },
"data-username": Em.computed.alias("user.username"), "data-username": Ember.computed.alias("user.username"),
// TODO: In later ember releases `hasBlock` works without this // TODO: In later ember releases `hasBlock` works without this
hasBlock: Em.computed.alias("template"), hasBlock: Ember.computed.alias("template"),
@computed("user.name", "user.username") @computed("user.name", "user.username")
name(name, username) { name(name, username) {

View File

@ -114,7 +114,7 @@ export default TextField.extend({
@observes("usernames") @observes("usernames")
_clearInput: function() { _clearInput: function() {
if (arguments.length > 1) { if (arguments.length > 1) {
if (Em.isEmpty(this.get("usernames"))) { if (Ember.isEmpty(this.get("usernames"))) {
this.$() this.$()
.parent() .parent()
.find("a") .find("a")

View File

@ -13,7 +13,7 @@ export default Ember.Component.extend(LoadMore, {
classNames: ["user-stream"], classNames: ["user-stream"],
_scrollTopOnModelChange: function() { _scrollTopOnModelChange: function() {
Em.run.schedule("afterRender", () => $(document).scrollTop(0)); Ember.run.schedule("afterRender", () => $(document).scrollTop(0));
}.observes("stream.user.id"), }.observes("stream.user.id"),
_inserted: function() { _inserted: function() {

View File

@ -17,7 +17,7 @@ export default Ember.Controller.extend({
}); });
}, },
disabled: Em.computed.empty("notificationLevelId"), disabled: Ember.computed.empty("notificationLevelId"),
actions: { actions: {
changeNotificationLevel() { changeNotificationLevel() {

View File

@ -47,7 +47,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
.then(function() { .then(function() {
self.send("closeModal"); self.send("closeModal");
self.setProperties({ date: "", time: "", saving: false }); self.setProperties({ date: "", time: "", saving: false });
Em.run.next(() => { Ember.run.next(() => {
DiscourseURL.routeTo(topic.get("url")); DiscourseURL.routeTo(topic.get("url"));
}); });
}) })

View File

@ -80,11 +80,11 @@ export default Ember.Controller.extend({
topicController: Ember.inject.controller("topic"), topicController: Ember.inject.controller("topic"),
application: Ember.inject.controller(), application: Ember.inject.controller(),
replyAsNewTopicDraft: Em.computed.equal( replyAsNewTopicDraft: Ember.computed.equal(
"model.draftKey", "model.draftKey",
Composer.REPLY_AS_NEW_TOPIC_KEY Composer.REPLY_AS_NEW_TOPIC_KEY
), ),
replyAsNewPrivateMessageDraft: Em.computed.equal( replyAsNewPrivateMessageDraft: Ember.computed.equal(
"model.draftKey", "model.draftKey",
Composer.REPLY_AS_NEW_PRIVATE_MESSAGE_KEY Composer.REPLY_AS_NEW_PRIVATE_MESSAGE_KEY
), ),
@ -155,7 +155,7 @@ export default Ember.Controller.extend({
return "title"; return "title";
}, },
showToolbar: Em.computed({ showToolbar: Ember.computed({
get() { get() {
const keyValueStore = getOwner(this).lookup("key-value-store:main"); const keyValueStore = getOwner(this).lookup("key-value-store:main");
const storedVal = keyValueStore.get("toolbar-enabled"); const storedVal = keyValueStore.get("toolbar-enabled");
@ -198,7 +198,7 @@ export default Ember.Controller.extend({
return currentUser && currentUser.get("staff"); return currentUser && currentUser.get("staff");
}, },
canUnlistTopic: Em.computed.and("model.creatingTopic", "isStaffUser"), canUnlistTopic: Ember.computed.and("model.creatingTopic", "isStaffUser"),
@computed("canWhisper", "model.post") @computed("canWhisper", "model.post")
showWhisperToggle(canWhisper, repliedToPost) { showWhisperToggle(canWhisper, repliedToPost) {

View File

@ -24,14 +24,14 @@ export default Ember.Controller.extend(
accountPasswordConfirm: 0, accountPasswordConfirm: 0,
accountChallenge: 0, accountChallenge: 0,
formSubmitted: false, formSubmitted: false,
rejectedEmails: Em.A([]), rejectedEmails: Ember.A([]),
prefilledUsername: null, prefilledUsername: null,
userFields: null, userFields: null,
isDeveloper: false, isDeveloper: false,
hasAuthOptions: Em.computed.notEmpty("authOptions"), hasAuthOptions: Ember.computed.notEmpty("authOptions"),
canCreateLocal: setting("enable_local_logins"), canCreateLocal: setting("enable_local_logins"),
showCreateForm: Em.computed.or("hasAuthOptions", "canCreateLocal"), showCreateForm: Ember.computed.or("hasAuthOptions", "canCreateLocal"),
resetForm() { resetForm() {
// We wrap the fields in a structure so we can assign a value // We wrap the fields in a structure so we can assign a value

View File

@ -7,10 +7,10 @@ export default Ember.Controller.extend({
loading: false, loading: false,
category: Em.computed.alias("navigationCategory.category"), category: Ember.computed.alias("navigationCategory.category"),
noSubcategories: Em.computed.alias("navigationCategory.noSubcategories"), noSubcategories: Ember.computed.alias("navigationCategory.noSubcategories"),
loadedAllItems: Em.computed.not("discoveryTopics.model.canLoadMore"), loadedAllItems: Ember.computed.not("discoveryTopics.model.canLoadMore"),
_showFooter: function() { _showFooter: function() {
this.set("application.showFooter", this.get("loadedAllItems")); this.set("application.showFooter", this.get("loadedAllItems"));

View File

@ -115,16 +115,16 @@ const controllerOpts = {
); );
}.property("model.filter", "model.topics.length"), }.property("model.filter", "model.topics.length"),
hasTopics: Em.computed.gt("model.topics.length", 0), hasTopics: Ember.computed.gt("model.topics.length", 0),
allLoaded: Em.computed.empty("model.more_topics_url"), allLoaded: Ember.computed.empty("model.more_topics_url"),
latest: endWith("model.filter", "latest"), latest: endWith("model.filter", "latest"),
new: endWith("model.filter", "new"), new: endWith("model.filter", "new"),
top: Em.computed.notEmpty("period"), top: Ember.computed.notEmpty("period"),
yearly: Em.computed.equal("period", "yearly"), yearly: Ember.computed.equal("period", "yearly"),
quarterly: Em.computed.equal("period", "quarterly"), quarterly: Ember.computed.equal("period", "quarterly"),
monthly: Em.computed.equal("period", "monthly"), monthly: Ember.computed.equal("period", "monthly"),
weekly: Em.computed.equal("period", "weekly"), weekly: Ember.computed.equal("period", "weekly"),
daily: Em.computed.equal("period", "daily"), daily: Ember.computed.equal("period", "daily"),
footerMessage: function() { footerMessage: function() {
if (!this.get("allLoaded")) { if (!this.get("allLoaded")) {

View File

@ -33,10 +33,10 @@ export default Ember.Controller.extend({
return false; return false;
}.property(), }.property(),
isNotFound: Em.computed.equal("thrown.status", 404), isNotFound: Ember.computed.equal("thrown.status", 404),
isForbidden: Em.computed.equal("thrown.status", 403), isForbidden: Ember.computed.equal("thrown.status", 403),
isServer: Em.computed.gte("thrown.status", 500), isServer: Ember.computed.gte("thrown.status", 500),
isUnknown: Em.computed.none("isNetwork", "isServer"), isUnknown: Ember.computed.none("isNetwork", "isServer"),
// TODO // TODO
// make ajax requests to /srv/status with exponential backoff // make ajax requests to /srv/status with exponential backoff
@ -63,7 +63,7 @@ export default Ember.Controller.extend({
} }
}.property("isNetwork", "isServer", "isUnknown"), }.property("isNetwork", "isServer", "isUnknown"),
requestUrl: Em.computed.alias("thrown.requestedUrl"), requestUrl: Ember.computed.alias("thrown.requestedUrl"),
desc: function() { desc: function() {
if (this.get("networkFixed")) { if (this.get("networkFixed")) {
@ -100,7 +100,7 @@ export default Ember.Controller.extend({
tryLoading: function() { tryLoading: function() {
this.set("loading", true); this.set("loading", true);
var self = this; var self = this;
Em.run.schedule("afterRender", function() { Ember.run.schedule("afterRender", function() {
self.get("lastTransition").retry(); self.get("lastTransition").retry();
self.set("loading", false); self.set("loading", false);
}); });

View File

@ -56,7 +56,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
return flagsAvailable; return flagsAvailable;
} else { } else {
// flagging topic // flagging topic
let lookup = Em.Object.create(); let lookup = Ember.Object.create();
let model = this.get("model"); let model = this.get("model");
model.get("actions_summary").forEach(a => { model.get("actions_summary").forEach(a => {
a.flagTopic = model; a.flagTopic = model;
@ -94,7 +94,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
return true; return true;
}.property("selected.is_custom_flag", "message.length"), }.property("selected.is_custom_flag", "message.length"),
submitDisabled: Em.computed.not("submitEnabled"), submitDisabled: Ember.computed.not("submitEnabled"),
// Staff accounts can "take action" // Staff accounts can "take action"
@computed("flagTopic", "selected.is_custom_flag") @computed("flagTopic", "selected.is_custom_flag")

View File

@ -50,7 +50,7 @@ export default Ember.Controller.extend({
@computed("q") @computed("q")
hasAutofocus(q) { hasAutofocus(q) {
return Em.isEmpty(q); return Ember.isEmpty(q);
}, },
@computed("q") @computed("q")

View File

@ -17,7 +17,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
const model = this.get("model"); const model = this.get("model");
const usernames = model.get("usernames"); const usernames = model.get("usernames");
if (Em.isEmpty(usernames)) { if (Ember.isEmpty(usernames)) {
return; return;
} }
let promise; let promise;

View File

@ -31,10 +31,12 @@ export default Ember.Controller.extend(ModalFunctionality, {
} }
}, },
previousFeaturedLink: Em.computed.alias( previousFeaturedLink: Ember.computed.alias(
"model.featured_link_changes.previous" "model.featured_link_changes.previous"
), ),
currentFeaturedLink: Em.computed.alias("model.featured_link_changes.current"), currentFeaturedLink: Ember.computed.alias(
"model.featured_link_changes.current"
),
previousTagChanges: customTagArray("model.tags_changes.previous"), previousTagChanges: customTagArray("model.tags_changes.previous"),
currentTagChanges: customTagArray("model.tags_changes.current"), currentTagChanges: customTagArray("model.tags_changes.current"),
@ -188,9 +190,9 @@ export default Ember.Controller.extend(ModalFunctionality, {
} }
}, },
displayingInline: Em.computed.equal("viewMode", "inline"), displayingInline: Ember.computed.equal("viewMode", "inline"),
displayingSideBySide: Em.computed.equal("viewMode", "side_by_side"), displayingSideBySide: Ember.computed.equal("viewMode", "side_by_side"),
displayingSideBySideMarkdown: Em.computed.equal( displayingSideBySideMarkdown: Ember.computed.equal(
"viewMode", "viewMode",
"side_by_side_markdown" "side_by_side_markdown"
), ),

View File

@ -120,13 +120,13 @@ export default Ember.Controller.extend(ModalFunctionality, {
topicId: Ember.computed.alias("model.id"), topicId: Ember.computed.alias("model.id"),
// Is Private Topic? (i.e. visible only to specific group members) // Is Private Topic? (i.e. visible only to specific group members)
isPrivateTopic: Em.computed.and( isPrivateTopic: Ember.computed.and(
"invitingToTopic", "invitingToTopic",
"model.category.read_restricted" "model.category.read_restricted"
), ),
// Is Private Message? // Is Private Message?
isMessage: Em.computed.equal("model.archetype", "private_message"), isMessage: Ember.computed.equal("model.archetype", "private_message"),
// Allow Existing Members? (username autocomplete) // Allow Existing Members? (username autocomplete)
allowExistingMembers: Ember.computed.alias("invitingToTopic"), allowExistingMembers: Ember.computed.alias("invitingToTopic"),

View File

@ -32,7 +32,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
canLoginLocal: setting("enable_local_logins"), canLoginLocal: setting("enable_local_logins"),
canLoginLocalWithEmail: setting("enable_local_logins_via_email"), canLoginLocalWithEmail: setting("enable_local_logins_via_email"),
loginRequired: Em.computed.alias("application.loginRequired"), loginRequired: Ember.computed.alias("application.loginRequired"),
secondFactorMethod: SECOND_FACTOR_METHODS.TOTP, secondFactorMethod: SECOND_FACTOR_METHODS.TOTP,
resetForm() { resetForm() {
@ -67,7 +67,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
return loggingIn ? "login.logging_in" : "login.title"; return loggingIn ? "login.logging_in" : "login.title";
}, },
loginDisabled: Em.computed.or("loggingIn", "loggedIn"), loginDisabled: Ember.computed.or("loggingIn", "loggedIn"),
@computed("loggingIn", "authenticate", "application.canSignUp") @computed("loggingIn", "authenticate", "application.canSignUp")
showSignupLink(loggingIn, authenticate, canSignUp) { showSignupLink(loggingIn, authenticate, canSignUp) {

View File

@ -1,8 +1,8 @@
import NavigationDefaultController from "discourse/controllers/navigation/default"; import NavigationDefaultController from "discourse/controllers/navigation/default";
export default NavigationDefaultController.extend({ export default NavigationDefaultController.extend({
showingParentCategory: Em.computed.none("category.parentCategory"), showingParentCategory: Ember.computed.none("category.parentCategory"),
showingSubcategoryList: Em.computed.and( showingSubcategoryList: Ember.computed.and(
"category.show_subcategory_list", "category.show_subcategory_list",
"showingParentCategory" "showingParentCategory"
) )

View File

@ -28,8 +28,8 @@ export default Ember.Controller.extend(
showAllAuthTokens: false, showAllAuthTokens: false,
cannotDeleteAccount: Em.computed.not("currentUser.can_delete_account"), cannotDeleteAccount: Ember.computed.not("currentUser.can_delete_account"),
deleteDisabled: Em.computed.or( deleteDisabled: Ember.computed.or(
"model.isSaving", "model.isSaving",
"deleting", "deleting",
"cannotDeleteAccount" "cannotDeleteAccount"

View File

@ -10,8 +10,8 @@ export default Ember.Controller.extend({
success: false, success: false,
newEmail: null, newEmail: null,
newEmailEmpty: Em.computed.empty("newEmail"), newEmailEmpty: Ember.computed.empty("newEmail"),
saveDisabled: Em.computed.or( saveDisabled: Ember.computed.or(
"saving", "saving",
"newEmailEmpty", "newEmailEmpty",
"taken", "taken",

View File

@ -15,8 +15,8 @@ export default Ember.Controller.extend({
maxLength: setting("max_username_length"), maxLength: setting("max_username_length"),
minLength: setting("min_username_length"), minLength: setting("min_username_length"),
newUsernameEmpty: Em.computed.empty("newUsername"), newUsernameEmpty: Ember.computed.empty("newUsername"),
saveDisabled: Em.computed.or( saveDisabled: Ember.computed.or(
"saving", "saving",
"newUsernameEmpty", "newUsernameEmpty",
"taken", "taken",

View File

@ -5,7 +5,7 @@ import { userPath } from "discourse/lib/url";
export default Ember.Controller.extend({ export default Ember.Controller.extend({
application: Ember.inject.controller(), application: Ember.inject.controller(),
showLoginButton: Em.computed.equal("model.path", "login"), showLoginButton: Ember.computed.equal("model.path", "login"),
@computed("model.path") @computed("model.path")
bodyClass: path => `static-${path}`, bodyClass: path => `static-${path}`,

View File

@ -889,7 +889,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
composerController composerController
.open(options) .open(options)
.then(() => { .then(() => {
return Em.isEmpty(quotedText) ? "" : quotedText; return Ember.isEmpty(quotedText) ? "" : quotedText;
}) })
.then(q => { .then(q => {
const postUrl = `${location.protocol}//${location.host}${post.get( const postUrl = `${location.protocol}//${location.host}${post.get(
@ -1243,7 +1243,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
if (callback) { if (callback) {
callback(this, data); callback(this, data);
} else { } else {
Em.Logger.warn("unknown topic bus message type", data); Ember.Logger.warn("unknown topic bus message type", data);
} }
} }
} }

View File

@ -35,7 +35,7 @@ export default Ember.Controller.extend({
}); });
}, 250).observes("searchTerm"), }, 250).observes("searchTerm"),
inviteRedeemed: Em.computed.equal("filter", "redeemed"), inviteRedeemed: Ember.computed.equal("filter", "redeemed"),
showBulkActionButtons: function() { showBulkActionButtons: function() {
return ( return (

View File

@ -7,11 +7,11 @@ export default Ember.Controller.extend({
user: Ember.inject.controller(), user: Ember.inject.controller(),
pmView: false, pmView: false,
viewingSelf: Em.computed.alias("user.viewingSelf"), viewingSelf: Ember.computed.alias("user.viewingSelf"),
isGroup: Em.computed.equal("pmView", "groups"), isGroup: Ember.computed.equal("pmView", "groups"),
currentPath: Em.computed.alias("application.currentPath"), currentPath: Ember.computed.alias("application.currentPath"),
selected: Em.computed.alias("userTopicsList.selected"), selected: Ember.computed.alias("userTopicsList.selected"),
bulkSelectEnabled: Em.computed.alias("userTopicsList.bulkSelectEnabled"), bulkSelectEnabled: Ember.computed.alias("userTopicsList.bulkSelectEnabled"),
showToggleBulkSelect: true, showToggleBulkSelect: true,
pmTaggingEnabled: Ember.computed.alias("site.can_tag_pms"), pmTaggingEnabled: Ember.computed.alias("site.can_tag_pms"),
tagId: null, tagId: null,

View File

@ -53,7 +53,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
return !suspended || isStaff; return !suspended || isStaff;
}, },
linkWebsite: Em.computed.not("model.isBasic"), linkWebsite: Ember.computed.not("model.isBasic"),
@computed("model.trust_level") @computed("model.trust_level")
removeNoFollow(trustLevel) { removeNoFollow(trustLevel) {

View File

@ -2,7 +2,7 @@ import { registerUnbound } from "discourse-common/lib/helpers";
import { isRTL } from "discourse/lib/text-direction"; import { isRTL } from "discourse/lib/text-direction";
import { iconHTML } from "discourse-common/lib/icon-library"; import { iconHTML } from "discourse-common/lib/icon-library";
var get = Em.get, var get = Ember.get,
escapeExpression = Handlebars.Utils.escapeExpression; escapeExpression = Handlebars.Utils.escapeExpression;
let _renderer = defaultCategoryLinkRenderer; let _renderer = defaultCategoryLinkRenderer;

View File

@ -30,9 +30,9 @@ function renderAvatar(user, options) {
options = options || {}; options = options || {};
if (user) { if (user) {
const name = Em.get(user, options.namePath || "name"); const name = Ember.get(user, options.namePath || "name");
const username = Em.get(user, options.usernamePath || "username"); const username = Ember.get(user, options.usernamePath || "username");
const avatarTemplate = Em.get( const avatarTemplate = Ember.get(
user, user,
options.avatarTemplatePath || "avatar_template" options.avatarTemplatePath || "avatar_template"
); );
@ -46,11 +46,11 @@ function renderAvatar(user, options) {
let title = options.title; let title = options.title;
if (!title && !options.ignoreTitle) { if (!title && !options.ignoreTitle) {
// first try to get a title // first try to get a title
title = Em.get(user, "title"); title = Ember.get(user, "title");
// if there was no title provided // if there was no title provided
if (!title) { if (!title) {
// try to retrieve a description // try to retrieve a description
const description = Em.get(user, "description"); const description = Ember.get(user, "description");
// if a description has been provided // if a description has been provided
if (description && description.length > 0) { if (description && description.length > 0) {
// preprend the username before the description // preprend the username before the description
@ -61,7 +61,7 @@ function renderAvatar(user, options) {
return avatarImg({ return avatarImg({
size: options.imageSize, size: options.imageSize,
extraClasses: Em.get(user, "extras") || options.extraClasses, extraClasses: Ember.get(user, "extras") || options.extraClasses,
title: title || displayName, title: title || displayName,
avatarTemplate: avatarTemplate avatarTemplate: avatarTemplate
}); });

View File

@ -5,7 +5,7 @@ export default {
after: "message-bus", after: "message-bus",
initialize(container) { initialize(container) {
const banner = Em.Object.create(PreloadStore.get("banner")), const banner = Ember.Object.create(PreloadStore.get("banner")),
site = container.lookup("site:main"); site = container.lookup("site:main");
site.set("banner", banner); site.set("banner", banner);
@ -16,7 +16,7 @@ export default {
} }
messageBus.subscribe("/site/banner", function(ban) { messageBus.subscribe("/site/banner", function(ban) {
site.set("banner", Em.Object.create(ban)); site.set("banner", Ember.Object.create(ban));
}); });
} }
}; };

View File

@ -82,7 +82,7 @@ export default {
} }
oldNotifications.insertAt( oldNotifications.insertAt(
insertPosition, insertPosition,
Em.Object.create(lastNotification) Ember.Object.create(lastNotification)
); );
} }

View File

@ -8,7 +8,7 @@ import addonFmt from "ember-addons/fmt";
@return {Function} computedProperty function @return {Function} computedProperty function
**/ **/
export function propertyEqual(p1, p2) { export function propertyEqual(p1, p2) {
return Em.computed(function() { return Ember.computed(function() {
return this.get(p1) === this.get(p2); return this.get(p1) === this.get(p2);
}).property(p1, p2); }).property(p1, p2);
} }
@ -22,7 +22,7 @@ export function propertyEqual(p1, p2) {
@return {Function} computedProperty function @return {Function} computedProperty function
**/ **/
export function propertyNotEqual(p1, p2) { export function propertyNotEqual(p1, p2) {
return Em.computed(function() { return Ember.computed(function() {
return this.get(p1) !== this.get(p2); return this.get(p1) !== this.get(p2);
}).property(p1, p2); }).property(p1, p2);
} }
@ -57,7 +57,7 @@ export function i18n(...args) {
/** /**
Uses an Ember String `fmt` call to format a string. See: Uses an Ember String `fmt` call to format a string. See:
http://emberjs.com/api/classes/Em.String.html#method_fmt http://emberjs.com/api/classes/Ember.String.html#method_fmt
@method fmt @method fmt
@params {String} properties* to format @params {String} properties* to format
@ -100,7 +100,7 @@ export function url(...args) {
export function endWith() { export function endWith() {
const args = Array.prototype.slice.call(arguments, 0); const args = Array.prototype.slice.call(arguments, 0);
const substring = args.pop(); const substring = args.pop();
const computed = Em.computed(function() { const computed = Ember.computed(function() {
const self = this; const self = this;
return _.all( return _.all(
args.map(function(a) { args.map(function(a) {
@ -124,7 +124,7 @@ export function endWith() {
@param {String} name of site setting @param {String} name of site setting
**/ **/
export function setting(name) { export function setting(name) {
return Em.computed(function() { return Ember.computed(function() {
return Discourse.SiteSettings[name]; return Discourse.SiteSettings[name];
}).property(); }).property();
} }

View File

@ -26,14 +26,14 @@ function init(messageBus, appEvents) {
try { try {
keyValueStore.getItem(focusTrackerKey); keyValueStore.getItem(focusTrackerKey);
} catch (e) { } catch (e) {
Em.Logger.info( Ember.Logger.info(
"Discourse desktop notifications are disabled - localStorage denied." "Discourse desktop notifications are disabled - localStorage denied."
); );
return; return;
} }
if (!("Notification" in window)) { if (!("Notification" in window)) {
Em.Logger.info( Ember.Logger.info(
"Discourse desktop notifications are disabled - not supported by browser" "Discourse desktop notifications are disabled - not supported by browser"
); );
return; return;
@ -47,7 +47,7 @@ function init(messageBus, appEvents) {
return; return;
} }
} catch (e) { } catch (e) {
Em.Logger.warn( Ember.Logger.warn(
"Unexpected error, Notification is defined on window but not a responding correctly " + "Unexpected error, Notification is defined on window but not a responding correctly " +
e e
); );
@ -58,7 +58,7 @@ function init(messageBus, appEvents) {
// Preliminary checks passed, continue with setup // Preliminary checks passed, continue with setup
setupNotifications(appEvents); setupNotifications(appEvents);
} catch (e) { } catch (e) {
Em.Logger.error(e); Ember.Logger.error(e);
} }
} }

View File

@ -97,7 +97,7 @@ export function translateResults(results, opts) {
!results.categories.length !results.categories.length
); );
return noResults ? null : Em.Object.create(results); return noResults ? null : Ember.Object.create(results);
} }
export function searchForTerm(term, opts) { export function searchForTerm(term, opts) {

View File

@ -176,7 +176,7 @@ const DiscourseURL = Ember.Object.extend({
routeTo(path, opts) { routeTo(path, opts) {
opts = opts || {}; opts = opts || {};
if (Em.isEmpty(path)) { if (Ember.isEmpty(path)) {
return; return;
} }

View File

@ -10,7 +10,7 @@ export default Ember.Mixin.create({
return e.get("badge.name"); return e.get("badge.name");
}); });
items.unshiftObject( items.unshiftObject(
Em.Object.create({ Ember.Object.create({
badge: Badge.create({ name: I18n.t("badges.none") }) badge: Badge.create({ name: I18n.t("badges.none") })
}) })
); );
@ -36,5 +36,5 @@ export default Ember.Mixin.create({
return selectedUserBadge; return selectedUserBadge;
}.property("selectedUserBadgeId"), }.property("selectedUserBadgeId"),
disableSave: Em.computed.alias("saving") disableSave: Ember.computed.alias("saving")
}); });

View File

@ -2,7 +2,7 @@
export function bufferedProperty(property) { export function bufferedProperty(property) {
const mixin = { const mixin = {
buffered: function() { buffered: function() {
return Em.ObjectProxy.extend(BufferedProxy).create({ return Ember.ObjectProxy.extend(BufferedProxy).create({
content: this.get(property) content: this.get(property)
}); });
}.property(property), }.property(property),

View File

@ -4,7 +4,7 @@ export default Ember.Mixin.create({
bulkSelectEnabled: false, bulkSelectEnabled: false,
selected: null, selected: null,
canBulkSelect: Em.computed.alias("currentUser.staff"), canBulkSelect: Ember.computed.alias("currentUser.staff"),
resetSelected: function() { resetSelected: function() {
this.set("selected", []); this.set("selected", []);

View File

@ -3,12 +3,12 @@ import { propertyEqual, setting } from "discourse/lib/computed";
export default Ember.Mixin.create({ export default Ember.Mixin.create({
isCurrentUser: propertyEqual("model.id", "currentUser.id"), isCurrentUser: propertyEqual("model.id", "currentUser.id"),
showEmailOnProfile: setting("show_email_on_profile"), showEmailOnProfile: setting("show_email_on_profile"),
canStaffCheckEmails: Em.computed.and( canStaffCheckEmails: Ember.computed.and(
"showEmailOnProfile", "showEmailOnProfile",
"currentUser.staff" "currentUser.staff"
), ),
canAdminCheckEmails: Em.computed.alias("currentUser.admin"), canAdminCheckEmails: Ember.computed.alias("currentUser.admin"),
canCheckEmails: Em.computed.or( canCheckEmails: Ember.computed.or(
"isCurrentUser", "isCurrentUser",
"canStaffCheckEmails", "canStaffCheckEmails",
"canAdminCheckEmails" "canAdminCheckEmails"

View File

@ -4,12 +4,12 @@ import {
} from "discourse/lib/utilities"; } from "discourse/lib/utilities";
import getUrl from "discourse-common/lib/get-url"; import getUrl from "discourse-common/lib/get-url";
export default Em.Mixin.create({ export default Ember.Mixin.create({
uploading: false, uploading: false,
uploadProgress: 0, uploadProgress: 0,
uploadDone() { uploadDone() {
Em.warn("You should implement `uploadDone`"); Ember.warn("You should implement `uploadDone`");
}, },
validateUploadedFilesOptions() { validateUploadedFilesOptions() {

View File

@ -2,7 +2,7 @@ import { propertyEqual } from "discourse/lib/computed";
import RestModel from "discourse/models/rest"; import RestModel from "discourse/models/rest";
export default RestModel.extend({ export default RestModel.extend({
hasOptions: Em.computed.gt("options.length", 0), hasOptions: Ember.computed.gt("options.length", 0),
isDefault: propertyEqual("id", "site.default_archetype"), isDefault: propertyEqual("id", "site.default_archetype"),
notDefault: Em.computed.not("isDefault") notDefault: Ember.computed.not("isDefault")
}); });

View File

@ -3,7 +3,7 @@ import BadgeGrouping from "discourse/models/badge-grouping";
import RestModel from "discourse/models/rest"; import RestModel from "discourse/models/rest";
const Badge = RestModel.extend({ const Badge = RestModel.extend({
newBadge: Em.computed.none("id"), newBadge: Ember.computed.none("id"),
url: function() { url: function() {
return Discourse.getURL(`/badges/${this.get("id")}/${this.get("slug")}`); return Discourse.getURL(`/badges/${this.get("id")}/${this.get("slug")}`);

Some files were not shown because too many files have changed in this diff Show More