diff --git a/app/assets/javascripts/admin/components/ace-editor.js.es6 b/app/assets/javascripts/admin/components/ace-editor.js.es6 index b3576c8bea1..2fa0c16d083 100644 --- a/app/assets/javascripts/admin/components/ace-editor.js.es6 +++ b/app/assets/javascripts/admin/components/ace-editor.js.es6 @@ -10,7 +10,7 @@ export default Ember.Component.extend({ @observes("editorId") editorIdChanged() { - if (this.get("autofocus")) { + if (this.autofocus) { this.send("focus"); } }, @@ -18,14 +18,14 @@ export default Ember.Component.extend({ @observes("content") contentChanged() { if (this._editor && !this._skipContentChangeEvent) { - this._editor.getSession().setValue(this.get("content")); + this._editor.getSession().setValue(this.content); } }, @observes("mode") modeChanged() { if (this._editor && !this._skipContentChangeEvent) { - this._editor.getSession().setMode("ace/mode/" + this.get("mode")); + this._editor.getSession().setMode("ace/mode/" + this.mode); } }, @@ -37,7 +37,7 @@ export default Ember.Component.extend({ changeDisabledState() { const editor = this._editor; if (editor) { - const disabled = this.get("disabled"); + const disabled = this.disabled; editor.setOptions({ readOnly: disabled, highlightActiveLine: !disabled, @@ -79,7 +79,7 @@ export default Ember.Component.extend({ editor.setTheme("ace/theme/chrome"); editor.setShowPrintMargin(false); editor.setOptions({ fontSize: "14px" }); - editor.getSession().setMode("ace/mode/" + this.get("mode")); + editor.getSession().setMode("ace/mode/" + this.mode); editor.on("change", () => { this._skipContentChangeEvent = true; this.set("content", editor.getSession().getValue()); @@ -103,7 +103,7 @@ export default Ember.Component.extend({ this.appEvents.on("ace:resize", this, "resize"); } - if (this.get("autofocus")) { + if (this.autofocus) { this.send("focus"); } }); diff --git a/app/assets/javascripts/admin/components/admin-backups-logs.js.es6 b/app/assets/javascripts/admin/components/admin-backups-logs.js.es6 index 4db599b3c38..56f90325f32 100644 --- a/app/assets/javascripts/admin/components/admin-backups-logs.js.es6 +++ b/app/assets/javascripts/admin/components/admin-backups-logs.js.es6 @@ -25,7 +25,7 @@ export default Ember.Component.extend( @on("init") @observes("logs.[]") _resetFormattedLogs() { - if (this.get("logs").length === 0) { + if (this.logs.length === 0) { this._reset(); // reset the cached logs whenever the model is reset this.rerenderBuffer(); } @@ -34,12 +34,12 @@ export default Ember.Component.extend( @on("init") @observes("logs.[]") _updateFormattedLogs: debounce(function() { - const logs = this.get("logs"); + const logs = this.logs; if (logs.length === 0) return; // do the log formatting only once for HELLish performance - let formattedLogs = this.get("formattedLogs"); - for (let i = this.get("index"), length = logs.length; i < length; i++) { + let formattedLogs = this.formattedLogs; + for (let i = this.index, length = logs.length; i < length; i++) { const date = logs[i].get("timestamp"), message = escapeExpression(logs[i].get("message")); formattedLogs += "[" + date + "] " + message + "\n"; @@ -56,7 +56,7 @@ export default Ember.Component.extend( }, 150), buildBuffer(buffer) { - const formattedLogs = this.get("formattedLogs"); + const formattedLogs = this.formattedLogs; if (formattedLogs && formattedLogs.length > 0) { buffer.push("
"); buffer.push(formattedLogs); diff --git a/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 b/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 index add82cbbe72..f2480802b86 100644 --- a/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 +++ b/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 @@ -8,27 +8,25 @@ export default Ember.Component.extend( rerenderTriggers: ["order", "ascending"], buildBuffer(buffer) { - const icon = this.get("icon"); + const icon = this.icon; if (icon) { buffer.push(iconHTML(icon)); } - buffer.push(I18n.t(this.get("i18nKey"))); + buffer.push(I18n.t(this.i18nKey)); - if (this.get("field") === this.get("order")) { - buffer.push( - iconHTML(this.get("ascending") ? "chevron-up" : "chevron-down") - ); + if (this.field === this.order) { + buffer.push(iconHTML(this.ascending ? "chevron-up" : "chevron-down")); } }, click() { - const currentOrder = this.get("order"); - const field = this.get("field"); + const currentOrder = this.order; + const field = this.field; if (currentOrder === field) { - this.set("ascending", this.get("ascending") ? null : true); + this.set("ascending", this.ascending ? null : true); } else { this.setProperties({ order: field, ascending: null }); } diff --git a/app/assets/javascripts/admin/components/admin-editable-field.js.es6 b/app/assets/javascripts/admin/components/admin-editable-field.js.es6 index 4c23ea6913e..9d91e2a27f1 100644 --- a/app/assets/javascripts/admin/components/admin-editable-field.js.es6 +++ b/app/assets/javascripts/admin/components/admin-editable-field.js.es6 @@ -11,13 +11,13 @@ export default Ember.Component.extend({ actions: { edit() { - this.set("buffer", this.get("value")); + this.set("buffer", this.value); this.toggleProperty("editing"); }, save() { // Action has to toggle 'editing' property. - this.action(this.get("buffer")); + this.action(this.buffer); } } }); diff --git a/app/assets/javascripts/admin/components/admin-graph.js.es6 b/app/assets/javascripts/admin/components/admin-graph.js.es6 index 9f6d83b354d..0c356c13075 100644 --- a/app/assets/javascripts/admin/components/admin-graph.js.es6 +++ b/app/assets/javascripts/admin/components/admin-graph.js.es6 @@ -6,7 +6,7 @@ export default Ember.Component.extend({ refreshChart() { const ctx = this.$()[0].getContext("2d"); - const model = this.get("model"); + const model = this.model; const rawData = this.get("model.data"); var data = { @@ -16,7 +16,7 @@ export default Ember.Component.extend({ data: rawData.map(r => r.y), label: model.get("title"), backgroundColor: `rgba(200,220,240,${ - this.get("type") === "bar" ? 1 : 0.3 + this.type === "bar" ? 1 : 0.3 })`, borderColor: "#08C" } @@ -24,7 +24,7 @@ export default Ember.Component.extend({ }; const config = { - type: this.get("type"), + type: this.type, data: data, options: { responsive: true, diff --git a/app/assets/javascripts/admin/components/admin-report-chart.js.es6 b/app/assets/javascripts/admin/components/admin-report-chart.js.es6 index 1c97f95f18d..b4ced4e1cb7 100644 --- a/app/assets/javascripts/admin/components/admin-report-chart.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report-chart.js.es6 @@ -35,7 +35,7 @@ export default Ember.Component.extend({ _scheduleChartRendering() { Ember.run.schedule("afterRender", () => { - this._renderChart(this.get("model"), this.$(".chart-canvas")); + this._renderChart(this.model, this.$(".chart-canvas")); }); }, diff --git a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 index 961a1fb4ecc..97b26fd92ba 100644 --- a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 @@ -33,7 +33,7 @@ export default Ember.Component.extend({ _scheduleChartRendering() { Ember.run.schedule("afterRender", () => { - this._renderChart(this.get("model"), this.$(".chart-canvas")); + this._renderChart(this.model, this.$(".chart-canvas")); }); }, diff --git a/app/assets/javascripts/admin/components/admin-report-table.js.es6 b/app/assets/javascripts/admin/components/admin-report-table.js.es6 index 28a7e3d84d3..0b52599a9b5 100644 --- a/app/assets/javascripts/admin/components/admin-report-table.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report-table.js.es6 @@ -134,8 +134,8 @@ export default Ember.Component.extend({ }, sortByLabel(label) { - if (this.get("sortLabel") === label) { - this.set("sortDirection", this.get("sortDirection") === 1 ? -1 : 1); + if (this.sortLabel === label) { + this.set("sortDirection", this.sortDirection === 1 ? -1 : 1); } else { this.set("sortLabel", label); } diff --git a/app/assets/javascripts/admin/components/admin-report.js.es6 b/app/assets/javascripts/admin/components/admin-report.js.es6 index fffa19d635d..2c41342bf31 100644 --- a/app/assets/javascripts/admin/components/admin-report.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report.js.es6 @@ -74,13 +74,13 @@ export default Ember.Component.extend({ didReceiveAttrs() { this._super(...arguments); - if (this.get("report")) { + if (this.report) { this._renderReport( - this.get("report"), - this.get("forcedModes"), - this.get("currentMode") + this.report, + this.forcedModes, + this.currentMode ); - } else if (this.get("dataSourceName")) { + } else if (this.dataSourceName) { this._fetchReport(); } }, @@ -199,8 +199,8 @@ export default Ember.Component.extend({ this.attrs.onRefresh({ type: this.get("model.type"), - startDate: this.get("startDate"), - endDate: this.get("endDate"), + startDate: this.startDate, + endDate: this.endDate, filters: customFilters }); }, @@ -208,8 +208,8 @@ export default Ember.Component.extend({ refreshReport() { this.attrs.onRefresh({ type: this.get("model.type"), - startDate: this.get("startDate"), - endDate: this.get("endDate"), + startDate: this.startDate, + endDate: this.endDate, filters: this.get("filters.customFilters") }); }, @@ -219,8 +219,8 @@ export default Ember.Component.extend({ exportEntity("report", { name: this.get("model.type"), - start_date: this.get("startDate"), - end_date: this.get("endDate"), + start_date: this.startDate, + end_date: this.endDate, category_id: customFilters.category, group_id: customFilters.group }).then(outputExportResult); @@ -249,16 +249,16 @@ export default Ember.Component.extend({ const sort = r => { if (r.length > 1) { - return r.findBy("type", this.get("dataSourceName")); + return r.findBy("type", this.dataSourceName); } else { return r; } }; - if (!this.get("startDate") || !this.get("endDate")) { + if (!this.startDate || !this.endDate) { report = sort(filteredReports)[0]; } else { - const reportKey = this.get("reportKey"); + const reportKey = this.reportKey; report = sort( filteredReports.filter(r => r.report_key.includes(reportKey)) @@ -273,8 +273,8 @@ export default Ember.Component.extend({ this._renderReport( report, - this.get("forcedModes"), - this.get("currentMode") + this.forcedModes, + this.currentMode ); }, @@ -317,22 +317,22 @@ export default Ember.Component.extend({ } }; - ReportLoader.enqueue(this.get("dataSourceName"), payload.data, callback); + ReportLoader.enqueue(this.dataSourceName, payload.data, callback); }); }, _buildPayload(facets) { let payload = { data: { cache: true, facets } }; - if (this.get("startDate")) { + if (this.startDate) { payload.data.start_date = moment - .utc(this.get("startDate"), "YYYY-MM-DD") + .utc(this.startDate, "YYYY-MM-DD") .toISOString(); } - if (this.get("endDate")) { + if (this.endDate) { payload.data.end_date = moment - .utc(this.get("endDate"), "YYYY-MM-DD") + .utc(this.endDate, "YYYY-MM-DD") .toISOString(); } diff --git a/app/assets/javascripts/admin/components/admin-theme-editor.js.es6 b/app/assets/javascripts/admin/components/admin-theme-editor.js.es6 index 19e5cc38279..e54cb32c609 100644 --- a/app/assets/javascripts/admin/components/admin-theme-editor.js.es6 +++ b/app/assets/javascripts/admin/components/admin-theme-editor.js.es6 @@ -56,7 +56,7 @@ export default Ember.Component.extend({ @computed("currentTargetName", "fieldName", "theme.theme_fields.@each.error") error(target, fieldName) { - return this.get("theme").getError(target, fieldName); + return this.theme.getError(target, fieldName); }, actions: { @@ -75,9 +75,9 @@ export default Ember.Component.extend({ addField(name) { if (!name) return; name = name.replace(/[^a-zA-Z0-9-_/]/g, ""); - this.get("theme").setField(this.get("currentTargetName"), name, ""); + this.theme.setField(this.currentTargetName, name, ""); this.setProperties({ newFieldName: "", addingField: false }); - this.fieldAdded(this.get("currentTargetName"), name); + this.fieldAdded(this.currentTargetName, name); }, toggleMaximize: function() { diff --git a/app/assets/javascripts/admin/components/admin-user-field-item.js.es6 b/app/assets/javascripts/admin/components/admin-user-field-item.js.es6 index c0ce3c9bb0f..1bf6128f1ce 100644 --- a/app/assets/javascripts/admin/components/admin-user-field-item.js.es6 +++ b/app/assets/javascripts/admin/components/admin-user-field-item.js.es6 @@ -26,7 +26,7 @@ export default Ember.Component.extend(bufferedProperty("userField"), { @on("didInsertElement") @observes("editing") _focusOnEdit() { - if (this.get("editing")) { + if (this.editing) { Ember.run.scheduleOnce("afterRender", this, "_focusName"); } }, @@ -66,7 +66,7 @@ export default Ember.Component.extend(bufferedProperty("userField"), { actions: { save() { - const buffered = this.get("buffered"); + const buffered = this.buffered; const attrs = buffered.getProperties( "name", "description", @@ -78,7 +78,7 @@ export default Ember.Component.extend(bufferedProperty("userField"), { "options" ); - this.get("userField") + this.userField .save(attrs) .then(() => { this.set("editing", false); @@ -94,7 +94,7 @@ export default Ember.Component.extend(bufferedProperty("userField"), { cancel() { const id = this.get("userField.id"); if (Ember.isEmpty(id)) { - this.destroyAction(this.get("userField")); + this.destroyAction(this.userField); } else { this.rollbackBuffer(); this.set("editing", false); diff --git a/app/assets/javascripts/admin/components/admin-watched-word.js.es6 b/app/assets/javascripts/admin/components/admin-watched-word.js.es6 index 53f7a8a056b..bed9bb21dc1 100644 --- a/app/assets/javascripts/admin/components/admin-watched-word.js.es6 +++ b/app/assets/javascripts/admin/components/admin-watched-word.js.es6 @@ -11,10 +11,10 @@ export default Ember.Component.extend( }, click() { - this.get("word") + this.word .destroy() .then(() => { - this.action(this.get("word")); + this.action(this.word); }) .catch(e => { bootbox.alert( diff --git a/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js.es6 b/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js.es6 index 6e91ce55c7b..7a6b5c13f15 100644 --- a/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js.es6 +++ b/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js.es6 @@ -25,8 +25,8 @@ export default Ember.Component.extend({ return eventTypeExists; }, set(value, eventTypeExists) { - const type = this.get("type"); - const model = this.get("model"); + const type = this.type; + const model = this.model; // add an association when not exists if (value !== eventTypeExists) { if (value) { diff --git a/app/assets/javascripts/admin/components/admin-web-hook-event.js.es6 b/app/assets/javascripts/admin/components/admin-web-hook-event.js.es6 index a9757927772..b558baa0b49 100644 --- a/app/assets/javascripts/admin/components/admin-web-hook-event.js.es6 +++ b/app/assets/javascripts/admin/components/admin-web-hook-event.js.es6 @@ -33,14 +33,14 @@ export default Ember.Component.extend({ @computed("expandDetails") expandRequestIcon(expandDetails) { - return expandDetails === this.get("expandDetailsRequestKey") + return expandDetails === this.expandDetailsRequestKey ? "ellipsis-h" : "ellipsis-v"; }, @computed("expandDetails") expandResponseIcon(expandDetails) { - return expandDetails === this.get("expandDetailsResponseKey") + return expandDetails === this.expandDetailsResponseKey ? "ellipsis-h" : "ellipsis-v"; }, @@ -69,9 +69,9 @@ export default Ember.Component.extend({ }, toggleRequest() { - const expandDetailsKey = this.get("expandDetailsRequestKey"); + const expandDetailsKey = this.expandDetailsRequestKey; - if (this.get("expandDetails") !== expandDetailsKey) { + if (this.expandDetails !== expandDetailsKey) { let headers = _.extend( { "Request URL": this.get("model.request_url"), @@ -91,9 +91,9 @@ export default Ember.Component.extend({ }, toggleResponse() { - const expandDetailsKey = this.get("expandDetailsResponseKey"); + const expandDetailsKey = this.expandDetailsResponseKey; - if (this.get("expandDetails") !== expandDetailsKey) { + if (this.expandDetails !== expandDetailsKey) { this.setProperties({ headers: plainJSON(this.get("model.response_headers")), body: this.get("model.response_body"), diff --git a/app/assets/javascripts/admin/components/admin-web-hook-status.js.es6 b/app/assets/javascripts/admin/components/admin-web-hook-status.js.es6 index 93b1dbe8b99..1dc7a27c351 100644 --- a/app/assets/javascripts/admin/components/admin-web-hook-status.js.es6 +++ b/app/assets/javascripts/admin/components/admin-web-hook-status.js.es6 @@ -23,7 +23,7 @@ export default Ember.Component.extend( }, buildBuffer(buffer) { - buffer.push(iconHTML(this.get("icon"), { class: this.get("class") })); + buffer.push(iconHTML(this.icon, { class: this.class })); buffer.push( I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`) ); diff --git a/app/assets/javascripts/admin/components/color-input.js.es6 b/app/assets/javascripts/admin/components/color-input.js.es6 index 28801436620..e57a8efde82 100644 --- a/app/assets/javascripts/admin/components/color-input.js.es6 +++ b/app/assets/javascripts/admin/components/color-input.js.es6 @@ -10,21 +10,21 @@ import { default as loadScript, loadCSS } from "discourse/lib/load-script"; export default Ember.Component.extend({ classNames: ["color-picker"], hexValueChanged: function() { - var hex = this.get("hexValue"); + var hex = this.hexValue; let $text = this.$("input.hex-input"); - if (this.get("valid")) { + if (this.valid) { $text.attr( "style", "color: " + - (this.get("brightnessValue") > 125 ? "black" : "white") + + (this.brightnessValue > 125 ? "black" : "white") + "; background-color: #" + hex + ";" ); - if (this.get("pickerLoaded")) { - this.$(".picker").spectrum({ color: "#" + this.get("hexValue") }); + if (this.pickerLoaded) { + this.$(".picker").spectrum({ color: "#" + this.hexValue }); } } else { $text.attr("style", ""); @@ -36,7 +36,7 @@ export default Ember.Component.extend({ loadCSS("/javascripts/spectrum.css").then(() => { Ember.run.schedule("afterRender", () => { this.$(".picker") - .spectrum({ color: "#" + this.get("hexValue") }) + .spectrum({ color: "#" + this.hexValue }) .on("change.spectrum", (me, color) => { this.set("hexValue", color.toHexString().replace("#", "")); }); diff --git a/app/assets/javascripts/admin/components/embeddable-host.js.es6 b/app/assets/javascripts/admin/components/embeddable-host.js.es6 index 8dda74d2211..f606e3152b1 100644 --- a/app/assets/javascripts/admin/components/embeddable-host.js.es6 +++ b/app/assets/javascripts/admin/components/embeddable-host.js.es6 @@ -30,25 +30,25 @@ export default Ember.Component.extend(bufferedProperty("host"), { }, save() { - if (this.get("cantSave")) { + if (this.cantSave) { return; } - const props = this.get("buffered").getProperties( + const props = this.buffered.getProperties( "host", "path_whitelist", "class_name" ); - props.category_id = this.get("categoryId"); + props.category_id = this.categoryId; - const host = this.get("host"); + const host = this.host; host .save(props) .then(() => { host.set( "category", - Discourse.Category.findById(this.get("categoryId")) + Discourse.Category.findById(this.categoryId) ); this.set("editToggled", false); }) @@ -58,17 +58,17 @@ export default Ember.Component.extend(bufferedProperty("host"), { delete() { bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), result => { if (result) { - this.get("host") + this.host .destroyRecord() .then(() => { - this.deleteHost(this.get("host")); + this.deleteHost(this.host); }); } }); }, cancel() { - const host = this.get("host"); + const host = this.host; if (host.get("isNew")) { this.deleteHost(host); } else { diff --git a/app/assets/javascripts/admin/components/inline-edit-checkbox.js.es6 b/app/assets/javascripts/admin/components/inline-edit-checkbox.js.es6 index fb93625716f..a31b4361679 100644 --- a/app/assets/javascripts/admin/components/inline-edit-checkbox.js.es6 +++ b/app/assets/javascripts/admin/components/inline-edit-checkbox.js.es6 @@ -12,12 +12,12 @@ export default Ember.Component.extend({ init() { this._super(...arguments); - this.set("checkedInternal", this.get("checked")); + this.set("checkedInternal", this.checked); }, @observes("checked") checkedChanged() { - this.set("checkedInternal", this.get("checked")); + this.set("checkedInternal", this.checked); }, @computed("labelKey") @@ -32,11 +32,11 @@ export default Ember.Component.extend({ actions: { cancelled() { - this.set("checkedInternal", this.get("checked")); + this.set("checkedInternal", this.checked); }, finished() { - this.set("checked", this.get("checkedInternal")); + this.set("checked", this.checkedInternal); this.action(); } } diff --git a/app/assets/javascripts/admin/components/ip-lookup.js.es6 b/app/assets/javascripts/admin/components/ip-lookup.js.es6 index bea470f8cb1..27586945045 100644 --- a/app/assets/javascripts/admin/components/ip-lookup.js.es6 +++ b/app/assets/javascripts/admin/components/ip-lookup.js.es6 @@ -18,18 +18,18 @@ export default Ember.Component.extend({ lookup() { this.set("show", true); - if (!this.get("location")) { - ajax("/admin/users/ip-info", { data: { ip: this.get("ip") } }).then( + if (!this.location) { + ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then( location => this.set("location", Ember.Object.create(location)) ); } - if (!this.get("other_accounts")) { + if (!this.other_accounts) { this.set("otherAccountsLoading", true); const data = { - ip: this.get("ip"), - exclude: this.get("userId"), + ip: this.ip, + exclude: this.userId, order: "trust_level DESC" }; @@ -51,8 +51,8 @@ export default Ember.Component.extend({ }, copy() { - let text = `IP: ${this.get("ip")}\n`; - const location = this.get("location"); + let text = `IP: ${this.ip}\n`; + const location = this.location; if (location) { if (location.hostname) { text += `${I18n.t("ip_lookup.hostname")}: ${location.hostname}\n`; @@ -97,8 +97,8 @@ export default Ember.Component.extend({ ajax("/admin/users/delete-others-with-same-ip.json", { type: "DELETE", data: { - ip: this.get("ip"), - exclude: this.get("userId"), + ip: this.ip, + exclude: this.userId, order: "trust_level DESC" } }).then(() => this.send("lookup")); diff --git a/app/assets/javascripts/admin/components/penalty-post-action.js.es6 b/app/assets/javascripts/admin/components/penalty-post-action.js.es6 index d042e99a742..c485364ad0f 100644 --- a/app/assets/javascripts/admin/components/penalty-post-action.js.es6 +++ b/app/assets/javascripts/admin/components/penalty-post-action.js.es6 @@ -17,7 +17,7 @@ export default Ember.Component.extend({ actions: { penaltyChanged() { - let postAction = this.get("postAction"); + let postAction = this.postAction; // If we switch to edit mode, jump to the edit textarea if (postAction === "edit") { diff --git a/app/assets/javascripts/admin/components/permalink-form.js.es6 b/app/assets/javascripts/admin/components/permalink-form.js.es6 index f8e571d31c2..bce150f8c95 100644 --- a/app/assets/javascripts/admin/components/permalink-form.js.es6 +++ b/app/assets/javascripts/admin/components/permalink-form.js.es6 @@ -24,13 +24,13 @@ export default Ember.Component.extend({ actions: { submit() { - if (!this.get("formSubmitted")) { + if (!this.formSubmitted) { this.set("formSubmitted", true); Permalink.create({ - url: this.get("url"), - permalink_type: this.get("permalinkType"), - permalink_type_value: this.get("permalink_type_value") + url: this.url, + permalink_type: this.permalinkType, + permalink_type_value: this.permalink_type_value }) .save() .then( diff --git a/app/assets/javascripts/admin/components/resumable-upload.js.es6 b/app/assets/javascripts/admin/components/resumable-upload.js.es6 index 2c86a2819ab..9c30065f240 100644 --- a/app/assets/javascripts/admin/components/resumable-upload.js.es6 +++ b/app/assets/javascripts/admin/components/resumable-upload.js.es6 @@ -31,7 +31,7 @@ export default Ember.Component.extend( @on("init") _initialize() { this.resumable = new Resumable({ - target: Discourse.getURL(this.get("target")), + target: Discourse.getURL(this.target), maxFiles: 1, // only 1 file at a time headers: { "X-CSRF-Token": document.querySelector("meta[name='csrf-token']") @@ -100,23 +100,23 @@ export default Ember.Component.extend( if (isUploading) { return progress + " %"; } else { - return this.get("uploadText"); + return this.uploadText; } }, buildBuffer(buffer) { - const icon = this.get("isUploading") ? "times" : "upload"; + const icon = this.isUploading ? "times" : "upload"; buffer.push(iconHTML(icon)); - buffer.push("" + this.get("text") + ""); + buffer.push("" + this.text + ""); buffer.push( "" ); }, click() { - if (this.get("isUploading")) { + if (this.isUploading) { this.resumable.cancel(); Ember.run.later(() => this._reset()); return false; diff --git a/app/assets/javascripts/admin/components/screened-ip-address-form.js.es6 b/app/assets/javascripts/admin/components/screened-ip-address-form.js.es6 index 64fd7eeb382..5573374a243 100644 --- a/app/assets/javascripts/admin/components/screened-ip-address-form.js.es6 +++ b/app/assets/javascripts/admin/components/screened-ip-address-form.js.es6 @@ -50,11 +50,11 @@ export default Ember.Component.extend({ actions: { submit() { - if (!this.get("formSubmitted")) { + if (!this.formSubmitted) { this.set("formSubmitted", true); const screenedIpAddress = ScreenedIpAddress.create({ - ip_address: this.get("ip_address"), - action_name: this.get("actionName") + ip_address: this.ip_address, + action_name: this.actionName }); screenedIpAddress .save() diff --git a/app/assets/javascripts/admin/components/secret-value-list.js.es6 b/app/assets/javascripts/admin/components/secret-value-list.js.es6 index 26e9f93e280..e6b1d8adc7d 100644 --- a/app/assets/javascripts/admin/components/secret-value-list.js.es6 +++ b/app/assets/javascripts/admin/components/secret-value-list.js.es6 @@ -9,11 +9,11 @@ export default Ember.Component.extend({ @on("didReceiveAttrs") _setupCollection() { - const values = this.get("values"); + const values = this.values; this.set( "collection", - this._splitValues(values, this.get("inputDelimiter") || "\n") + this._splitValues(values, this.inputDelimiter || "\n") ); }, @@ -29,9 +29,9 @@ export default Ember.Component.extend({ }, addValue() { - if (this._checkInvalidInput([this.get("newKey"), this.get("newSecret")])) + if (this._checkInvalidInput([this.newKey, this.newSecret])) return; - this._addValue(this.get("newKey"), this.get("newSecret")); + this._addValue(this.newKey, this.newSecret); this.setProperties({ newKey: "", newSecret: "" }); }, @@ -54,18 +54,18 @@ export default Ember.Component.extend({ }, _addValue(value, secret) { - this.get("collection").addObject({ key: value, secret: secret }); + this.collection.addObject({ key: value, secret: secret }); this._saveValues(); }, _removeValue(value) { - const collection = this.get("collection"); + const collection = this.collection; collection.removeObject(value); this._saveValues(); }, _replaceValue(index, newValue, keyName) { - let item = this.get("collection")[index]; + let item = this.collection[index]; Ember.set(item, keyName, newValue); this._saveValues(); @@ -74,7 +74,7 @@ export default Ember.Component.extend({ _saveValues() { this.set( "values", - this.get("collection") + this.collection .map(function(elem) { return `${elem.key}|${elem.secret}`; }) diff --git a/app/assets/javascripts/admin/components/site-setting.js.es6 b/app/assets/javascripts/admin/components/site-setting.js.es6 index bd68c7d11ed..78696c6e06c 100644 --- a/app/assets/javascripts/admin/components/site-setting.js.es6 +++ b/app/assets/javascripts/admin/components/site-setting.js.es6 @@ -4,7 +4,7 @@ import SettingComponent from "admin/mixins/setting-component"; export default Ember.Component.extend(BufferedContent, SettingComponent, { _save() { - const setting = this.get("buffered"); + const setting = this.buffered; return SiteSetting.update(setting.get("setting"), setting.get("value")); } }); diff --git a/app/assets/javascripts/admin/components/site-text-summary.js.es6 b/app/assets/javascripts/admin/components/site-text-summary.js.es6 index 1980b108502..003ff2ffef2 100644 --- a/app/assets/javascripts/admin/components/site-text-summary.js.es6 +++ b/app/assets/javascripts/admin/components/site-text-summary.js.es6 @@ -17,18 +17,18 @@ export default Ember.Component.extend({ }, click() { - this.editAction(this.get("siteText")); + this.editAction(this.siteText); }, _searchTerm() { - const regex = this.get("searchRegex"); - const siteText = this.get("siteText"); + const regex = this.searchRegex; + const siteText = this.siteText; if (regex && siteText) { const matches = siteText.value.match(new RegExp(regex, "i")); if (matches) return matches[0]; } - return this.get("term"); + return this.term; } }); diff --git a/app/assets/javascripts/admin/components/theme-setting-editor.js.es6 b/app/assets/javascripts/admin/components/theme-setting-editor.js.es6 index c95dd220db4..df9398aeccf 100644 --- a/app/assets/javascripts/admin/components/theme-setting-editor.js.es6 +++ b/app/assets/javascripts/admin/components/theme-setting-editor.js.es6 @@ -4,7 +4,7 @@ import SettingComponent from "admin/mixins/setting-component"; export default Ember.Component.extend(BufferedContent, SettingComponent, { layoutName: "admin/templates/components/site-setting", _save() { - return this.get("model").saveSettings( + return this.model.saveSettings( this.get("setting.setting"), this.get("buffered.value") ); diff --git a/app/assets/javascripts/admin/components/theme-translation.js.es6 b/app/assets/javascripts/admin/components/theme-translation.js.es6 index ad0cb8a7493..ab29ac23129 100644 --- a/app/assets/javascripts/admin/components/theme-translation.js.es6 +++ b/app/assets/javascripts/admin/components/theme-translation.js.es6 @@ -8,7 +8,7 @@ export default Ember.Component.extend(BufferedContent, SettingComponent, { settingName: Ember.computed.alias("translation.key"), _save() { - return this.get("model").saveTranslation( + return this.model.saveTranslation( this.get("translation.key"), this.get("buffered.value") ); diff --git a/app/assets/javascripts/admin/components/themes-list-item.js.es6 b/app/assets/javascripts/admin/components/themes-list-item.js.es6 index fad6702a3ce..5043f6f7437 100644 --- a/app/assets/javascripts/admin/components/themes-list-item.js.es6 +++ b/app/assets/javascripts/admin/components/themes-list-item.js.es6 @@ -56,12 +56,12 @@ export default Ember.Component.extend({ "childrenExpanded" ) children() { - const theme = this.get("theme"); + const theme = this.theme; let children = theme.get("childThemes"); if (theme.get("component") || !children) { return []; } - children = this.get("childrenExpanded") + children = this.childrenExpanded ? children : children.slice(0, MAX_COMPONENTS); return children.map(t => t.get("name")); diff --git a/app/assets/javascripts/admin/components/themes-list.js.es6 b/app/assets/javascripts/admin/components/themes-list.js.es6 index b97ecfd9b6e..d306bab11cc 100644 --- a/app/assets/javascripts/admin/components/themes-list.js.es6 +++ b/app/assets/javascripts/admin/components/themes-list.js.es6 @@ -16,7 +16,7 @@ export default Ember.Component.extend({ @computed("themes", "components", "currentTab") themesList(themes, components) { - if (this.get("themesTabActive")) { + if (this.themesTabActive) { return themes; } else { return components; @@ -30,7 +30,7 @@ export default Ember.Component.extend({ "themesList.@each.default" ) inactiveThemes(themes) { - if (this.get("componentsTabActive")) { + if (this.componentsTabActive) { return themes.filter(theme => theme.get("parent_themes.length") <= 0); } return themes.filter( @@ -45,7 +45,7 @@ export default Ember.Component.extend({ "themesList.@each.default" ) activeThemes(themes) { - if (this.get("componentsTabActive")) { + if (this.componentsTabActive) { return themes.filter(theme => theme.get("parent_themes.length") > 0); } else { themes = themes.filter( @@ -63,7 +63,7 @@ export default Ember.Component.extend({ actions: { changeView(newTab) { - if (newTab !== this.get("currentTab")) { + if (newTab !== this.currentTab) { this.set("currentTab", newTab); } }, diff --git a/app/assets/javascripts/admin/components/value-list.js.es6 b/app/assets/javascripts/admin/components/value-list.js.es6 index 9e656bed707..d99541bd44a 100644 --- a/app/assets/javascripts/admin/components/value-list.js.es6 +++ b/app/assets/javascripts/admin/components/value-list.js.es6 @@ -15,15 +15,15 @@ export default Ember.Component.extend({ @on("didReceiveAttrs") _setupCollection() { - const values = this.get("values"); - if (this.get("inputType") === "array") { + const values = this.values; + if (this.inputType === "array") { this.set("collection", values || []); return; } this.set( "collection", - this._splitValues(values, this.get("inputDelimiter") || "\n") + this._splitValues(values, this.inputDelimiter || "\n") ); }, @@ -33,7 +33,7 @@ export default Ember.Component.extend({ }, keyDown(event) { - if (event.keyCode === 13) this.send("addValue", this.get("newValue")); + if (event.keyCode === 13) this.send("addValue", this.newValue); }, actions: { @@ -42,7 +42,7 @@ export default Ember.Component.extend({ }, addValue(newValue) { - if (this.get("inputInvalid")) return; + if (this.inputInvalid) return; this.set("newValue", ""); this._addValue(newValue); @@ -58,30 +58,30 @@ export default Ember.Component.extend({ }, _addValue(value) { - this.get("collection").addObject(value); + this.collection.addObject(value); this._saveValues(); }, _removeValue(value) { - const collection = this.get("collection"); + const collection = this.collection; collection.removeObject(value); this._saveValues(); }, _replaceValue(index, newValue) { - this.get("collection").replace(index, 1, [newValue]); + this.collection.replace(index, 1, [newValue]); this._saveValues(); }, _saveValues() { - if (this.get("inputType") === "array") { - this.set("values", this.get("collection")); + if (this.inputType === "array") { + this.set("values", this.collection); return; } this.set( "values", - this.get("collection").join(this.get("inputDelimiter") || "\n") + this.collection.join(this.inputDelimiter || "\n") ); }, diff --git a/app/assets/javascripts/admin/components/watched-word-form.js.es6 b/app/assets/javascripts/admin/components/watched-word-form.js.es6 index bdfafc12afb..3f11f4b3be4 100644 --- a/app/assets/javascripts/admin/components/watched-word-form.js.es6 +++ b/app/assets/javascripts/admin/components/watched-word-form.js.es6 @@ -21,16 +21,16 @@ export default Ember.Component.extend({ @observes("word") removeMessage() { - if (this.get("showMessage") && !Ember.isEmpty(this.get("word"))) { + if (this.showMessage && !Ember.isEmpty(this.word)) { this.set("showMessage", false); } }, @computed("word") isUniqueWord(word) { - const words = this.get("filteredContent") || []; + const words = this.filteredContent || []; const filtered = words.filter( - content => content.action === this.get("actionKey") + content => content.action === this.actionKey ); return filtered.every( content => content.word.toLowerCase() !== word.toLowerCase() @@ -39,7 +39,7 @@ export default Ember.Component.extend({ actions: { submit() { - if (!this.get("isUniqueWord")) { + if (!this.isUniqueWord) { this.setProperties({ showMessage: true, message: I18n.t("admin.watched_words.form.exists") @@ -47,12 +47,12 @@ export default Ember.Component.extend({ return; } - if (!this.get("formSubmitted")) { + if (!this.formSubmitted) { this.set("formSubmitted", true); const watchedWord = WatchedWord.create({ - word: this.get("word"), - action: this.get("actionKey") + word: this.word, + action: this.actionKey }); watchedWord diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys.js.es6 b/app/assets/javascripts/admin/controllers/admin-api-keys.js.es6 index 1ec203fd893..87b26f5ef1a 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-api-keys.js.es6 @@ -9,7 +9,7 @@ export default Ember.Controller.extend({ actions: { generateMasterKey() { - ApiKey.generateMasterKey().then(key => this.get("model").pushObject(key)); + ApiKey.generateMasterKey().then(key => this.model.pushObject(key)); }, regenerateKey(key) { @@ -32,7 +32,7 @@ export default Ember.Controller.extend({ I18n.t("yes_value"), result => { if (result) { - key.revoke().then(() => this.get("model").removeObject(key)); + key.revoke().then(() => this.model.removeObject(key)); } } ); diff --git a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 index d7e80054325..1f7382f54be 100644 --- a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 @@ -33,7 +33,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { actions: { save() { - if (!this.get("saving")) { + if (!this.saving) { let fields = [ "allow_title", "multiple_grant", @@ -54,7 +54,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { ]; if (this.get("buffered.system")) { - var protectedFields = this.get("protectedSystemFields") || []; + var protectedFields = this.protectedSystemFields || []; fields = _.filter(fields, f => !protectedFields.includes(f)); } @@ -72,7 +72,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { ]; const data = {}; - const buffered = this.get("buffered"); + const buffered = this.buffered; fields.forEach(function(field) { var d = buffered.get(field); if (boolFields.includes(field)) { @@ -81,9 +81,9 @@ export default Ember.Controller.extend(bufferedProperty("model"), { data[field] = d; }); - const newBadge = !this.get("id"); - const model = this.get("model"); - this.get("model") + const newBadge = !this.id; + const model = this.model; + this.model .save(data) .then(() => { if (newBadge) { @@ -107,7 +107,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { destroy() { const adminBadges = this.get("adminBadges.model"); - const model = this.get("model"); + const model = this.model; if (!model.get("id")) { this.transitionToRoute("adminBadges.index"); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-colors-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-colors-show.js.es6 index e49e87fc4b8..3fbdb989cff 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-colors-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-colors-show.js.es6 @@ -23,7 +23,7 @@ export default Ember.Controller.extend({ $(".table.colors").hide(); let area = $(""); $(".table.colors").after(area); - area.text(this.get("model").schemeJson()); + area.text(this.model.schemeJson()); let range = document.createRange(); range.selectNode(area[0]); window.getSelection().addRange(range); @@ -51,7 +51,7 @@ export default Ember.Controller.extend({ }, copy() { - var newColorScheme = Ember.copy(this.get("model"), true); + var newColorScheme = Ember.copy(this.model, true); newColorScheme.set( "name", I18n.t("admin.customize.colors.copy_name_prefix") + @@ -59,17 +59,17 @@ export default Ember.Controller.extend({ this.get("model.name") ); newColorScheme.save().then(() => { - this.get("allColors").pushObject(newColorScheme); + this.allColors.pushObject(newColorScheme); this.replaceRoute("adminCustomize.colors.show", newColorScheme); }); }, save: function() { - this.get("model").save(); + this.model.save(); }, destroy: function() { - const model = this.get("model"); + const model = this.model; return bootbox.confirm( I18n.t("admin.customize.colors.delete_confirm"), I18n.t("no_value"), @@ -77,7 +77,7 @@ export default Ember.Controller.extend({ result => { if (result) { model.destroy().then(() => { - this.get("allColors").removeObject(model); + this.allColors.removeObject(model); this.replaceRoute("adminCustomize.colors"); }); } diff --git a/app/assets/javascripts/admin/controllers/admin-customize-colors.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-colors.js.es6 index faf9d29a60f..bc4fd72d53d 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-colors.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-colors.js.es6 @@ -4,12 +4,12 @@ import { default as computed } from "ember-addons/ember-computed-decorators"; export default Ember.Controller.extend({ @computed("model.@each.id") baseColorScheme() { - return this.get("model").findBy("is_base", true); + return this.model.findBy("is_base", true); }, @computed("model.@each.id") baseColorSchemes() { - return this.get("model").filterBy("is_base", true); + return this.model.filterBy("is_base", true); }, @computed("baseColorScheme") @@ -23,7 +23,7 @@ export default Ember.Controller.extend({ actions: { newColorSchemeWithBase(baseKey) { - const base = this.get("baseColorSchemes").findBy( + const base = this.baseColorSchemes.findBy( "base_scheme_id", baseKey ); @@ -33,7 +33,7 @@ export default Ember.Controller.extend({ base_scheme_id: base.get("base_scheme_id") }); newColorScheme.save().then(() => { - this.get("model").pushObject(newColorScheme); + this.model.pushObject(newColorScheme); newColorScheme.set("savingStatus", null); this.replaceRoute("adminCustomize.colors.show", newColorScheme); }); @@ -41,7 +41,7 @@ export default Ember.Controller.extend({ newColorScheme() { showModal("admin-color-scheme-select-base", { - model: this.get("baseColorSchemes"), + model: this.baseColorSchemes, admin: true }); } diff --git a/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6 index 3fafd28e557..926fd565e14 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6 @@ -17,8 +17,8 @@ export default Ember.Controller.extend(bufferedProperty("emailTemplate"), { actions: { saveChanges() { this.set("saved", false); - const buffered = this.get("buffered"); - this.get("emailTemplate") + const buffered = this.buffered; + this.emailTemplate .save(buffered.getProperties("subject", "body")) .then(() => { this.set("saved", true); @@ -32,10 +32,10 @@ export default Ember.Controller.extend(bufferedProperty("emailTemplate"), { I18n.t("admin.customize.email_templates.revert_confirm"), result => { if (result) { - this.get("emailTemplate") + this.emailTemplate .revert() .then(props => { - const buffered = this.get("buffered"); + const buffered = this.buffered; buffered.setProperties(props); this.commitBuffer(); }) diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js.es6 index 9c33c27392a..0c18d7e6996 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js.es6 @@ -36,7 +36,7 @@ export default Ember.Controller.extend({ actions: { save() { this.set("saving", true); - this.get("model") + this.model .saveChanges("theme_fields") .finally(() => { this.set("saving", false); @@ -45,7 +45,7 @@ export default Ember.Controller.extend({ fieldAdded(target, name) { this.replaceRoute( - this.get("editRouteName"), + this.editRouteName, this.get("model.id"), target, name @@ -55,9 +55,9 @@ export default Ember.Controller.extend({ onlyOverriddenChanged(onlyShowOverridden) { if (onlyShowOverridden) { if ( - !this.get("model").hasEdited( - this.get("currentTargetName"), - this.get("fieldName") + !this.model.hasEdited( + this.currentTargetName, + this.fieldName ) ) { let firstTarget = this.get("model.targets").find(t => t.edited); @@ -66,7 +66,7 @@ export default Ember.Controller.extend({ ); this.replaceRoute( - this.get("editRouteName"), + this.editRouteName, this.get("model.id"), firstTarget.name, firstField.name diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 index ff3648f6609..552a1d3aab7 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 @@ -100,7 +100,7 @@ export default Ember.Controller.extend({ }, commitSwitchType() { - const model = this.get("model"); + const model = this.model; const newValue = !model.get("component"); model.set("component", newValue); @@ -141,7 +141,7 @@ export default Ember.Controller.extend({ }, transitionToEditRoute() { this.transitionToRoute( - this.get("editRouteName"), + this.editRouteName, this.get("model.id"), "common", "scss" @@ -154,7 +154,7 @@ export default Ember.Controller.extend({ actions: { updateToLatest() { this.set("updatingRemote", true); - this.get("model") + this.model .updateToLatest() .catch(popupAjaxError) .finally(() => { @@ -164,7 +164,7 @@ export default Ember.Controller.extend({ checkForThemeUpdates() { this.set("updatingRemote", true); - this.get("model") + this.model .checkForUpdates() .catch(popupAjaxError) .finally(() => { @@ -177,7 +177,7 @@ export default Ember.Controller.extend({ }, addUpload(info) { - let model = this.get("model"); + let model = this.model; model.setField("common", info.name, "", info.upload_id, THEME_UPLOAD_VAR); model.saveChanges("theme_fields").catch(e => popupAjaxError(e)); }, @@ -186,23 +186,23 @@ export default Ember.Controller.extend({ this.set("colorSchemeId", this.get("model.color_scheme_id")); }, changeScheme() { - let schemeId = this.get("colorSchemeId"); + let schemeId = this.colorSchemeId; this.set( "model.color_scheme_id", schemeId === null ? null : parseInt(schemeId) ); - this.get("model").saveChanges("color_scheme_id"); + this.model.saveChanges("color_scheme_id"); }, startEditingName() { this.set("oldName", this.get("model.name")); this.set("editingName", true); }, cancelEditingName() { - this.set("model.name", this.get("oldName")); + this.set("model.name", this.oldName); this.set("editingName", false); }, finishedEditingName() { - this.get("model").saveChanges("name"); + this.model.saveChanges("name"); this.set("editingName", false); }, @@ -222,10 +222,10 @@ export default Ember.Controller.extend({ }, applyDefault() { - const model = this.get("model"); + const model = this.model; model.saveChanges("default").then(() => { if (model.get("default")) { - this.get("allThemes").forEach(theme => { + this.allThemes.forEach(theme => { if (theme !== model && theme.get("default")) { theme.set("default", false); } @@ -235,13 +235,13 @@ export default Ember.Controller.extend({ }, applyUserSelectable() { - this.get("model").saveChanges("user_selectable"); + this.model.saveChanges("user_selectable"); }, addChildTheme() { - let themeId = parseInt(this.get("selectedChildThemeId")); - let theme = this.get("allThemes").findBy("id", themeId); - this.get("model").addChildTheme(theme); + let themeId = parseInt(this.selectedChildThemeId); + let theme = this.allThemes.findBy("id", themeId); + this.model.addChildTheme(theme); }, removeUpload(upload) { @@ -251,14 +251,14 @@ export default Ember.Controller.extend({ I18n.t("yes_value"), result => { if (result) { - this.get("model").removeField(upload); + this.model.removeField(upload); } } ); }, removeChildTheme(theme) { - this.get("model").removeChildTheme(theme); + this.model.removeChildTheme(theme); }, destroy() { @@ -270,9 +270,9 @@ export default Ember.Controller.extend({ I18n.t("yes_value"), result => { if (result) { - const model = this.get("model"); + const model = this.model; model.destroyRecord().then(() => { - this.get("allThemes").removeObject(model); + this.allThemes.removeObject(model); this.transitionToRoute("adminCustomizeThemes"); }); } @@ -282,12 +282,12 @@ export default Ember.Controller.extend({ switchType() { const relatives = this.get("model.component") - ? this.get("parentThemes") + ? this.parentThemes : this.get("model.childThemes"); if (relatives && relatives.length > 0) { const names = relatives.map(relative => relative.get("name")); bootbox.confirm( - I18n.t(`${this.get("convertKey")}_alert`, { + I18n.t(`${this.convertKey}_alert`, { relatives: names.join(", ") }), I18n.t("no_value"), diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 index 6997cb9f0c1..205c5fe8539 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 @@ -6,7 +6,7 @@ import PeriodComputationMixin from "admin/mixins/period-computation"; function staticReport(reportType) { return function() { - return Ember.makeArray(this.get("reports")).find( + return Ember.makeArray(this.reports).find( report => report.type === reportType ); }.property("reports.[]"); @@ -27,8 +27,8 @@ export default Ember.Controller.extend(PeriodComputationMixin, { @computed activityMetricsFilters() { return { - startDate: this.get("lastMonth"), - endDate: this.get("today") + startDate: this.lastMonth, + endDate: this.today }; }, @@ -45,7 +45,7 @@ export default Ember.Controller.extend(PeriodComputationMixin, { startDate: moment() .subtract(6, "days") .startOf("day"), - endDate: this.get("today") + endDate: this.today }; }, @@ -55,7 +55,7 @@ export default Ember.Controller.extend(PeriodComputationMixin, { startDate: moment() .subtract(1, "month") .startOf("day"), - endDate: this.get("today") + endDate: this.today }; }, @@ -78,13 +78,13 @@ export default Ember.Controller.extend(PeriodComputationMixin, { storageReport: staticReport("storage_report"), fetchDashboard() { - if (this.get("isLoading")) return; + if (this.isLoading) return; if ( - !this.get("dashboardFetchedAt") || + !this.dashboardFetchedAt || moment() .subtract(30, "minutes") - .toDate() > this.get("dashboardFetchedAt") + .toDate() > this.dashboardFetchedAt ) { this.set("isLoading", true); @@ -99,7 +99,7 @@ export default Ember.Controller.extend(PeriodComputationMixin, { }); }) .catch(e => { - this.get("exceptionController").set("thrown", e.jqXHR); + this.exceptionController.set("thrown", e.jqXHR); this.replaceRoute("exception"); }) .finally(() => this.set("isLoading", false)); diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard.js.es6 b/app/assets/javascripts/admin/controllers/admin-dashboard.js.es6 index 7d6c68ea098..0ff4b540d19 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-dashboard.js.es6 @@ -17,13 +17,13 @@ export default Ember.Controller.extend({ }, fetchProblems() { - if (this.get("isLoadingProblems")) return; + if (this.isLoadingProblems) return; if ( - !this.get("problemsFetchedAt") || + !this.problemsFetchedAt || moment() .subtract(PROBLEMS_CHECK_MINUTES, "minutes") - .toDate() > this.get("problemsFetchedAt") + .toDate() > this.problemsFetchedAt ) { this._loadProblems(); } @@ -32,13 +32,13 @@ export default Ember.Controller.extend({ fetchDashboard() { const versionChecks = this.siteSettings.version_checks; - if (this.get("isLoading") || !versionChecks) return; + if (this.isLoading || !versionChecks) return; if ( - !this.get("dashboardFetchedAt") || + !this.dashboardFetchedAt || moment() .subtract(30, "minutes") - .toDate() > this.get("dashboardFetchedAt") + .toDate() > this.dashboardFetchedAt ) { this.set("isLoading", true); @@ -55,7 +55,7 @@ export default Ember.Controller.extend({ this.setProperties(properties); }) .catch(e => { - this.get("exceptionController").set("thrown", e.jqXHR); + this.exceptionController.set("thrown", e.jqXHR); this.replaceRoute("exception"); }) .finally(() => { diff --git a/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js.es6 index 34b2d7b049c..c98fb7cfb91 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js.es6 @@ -14,7 +14,7 @@ export default Ember.Controller.extend({ ajax("/admin/email/advanced-test", { type: "POST", - data: { email: this.get("email") } + data: { email: this.email } }) .then(data => { this.setProperties({ diff --git a/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 index 0c366306256..02860948c03 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 @@ -30,7 +30,7 @@ export default Ember.Controller.extend({ ajax("/admin/email/test", { type: "POST", - data: { email_address: this.get("testEmailAddress") } + data: { email_address: this.testEmailAddress } }) .then(response => this.set("sentTestEmailMessage", response.sent_test_email_message) diff --git a/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 index b08a5115bd6..c7c2df8c958 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 @@ -4,7 +4,7 @@ export default Ember.Controller.extend({ loading: false, loadLogs(sourceModel, loadMore) { - if ((loadMore && this.get("loading")) || this.get("model.allLoaded")) { + if ((loadMore && this.loading) || this.get("model.allLoaded")) { return; } @@ -13,14 +13,14 @@ export default Ember.Controller.extend({ sourceModel = sourceModel || EmailLog; return sourceModel - .findAll(this.get("filter"), loadMore ? this.get("model.length") : null) + .findAll(this.filter, loadMore ? this.get("model.length") : null) .then(logs => { - if (this.get("model") && loadMore && logs.length < 50) { - this.get("model").set("allLoaded", true); + if (this.model && loadMore && logs.length < 50) { + this.model.set("allLoaded", true); } - if (this.get("model") && loadMore) { - this.get("model").addObjects(logs); + if (this.model && loadMore) { + this.model.addObjects(logs); } else { this.set("model", logs); } diff --git a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 index 9517a3f9a74..9b4a5e10cbf 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 @@ -12,18 +12,18 @@ export default Ember.Controller.extend({ actions: { refresh() { - const model = this.get("model"); + const model = this.model; this.set("loading", true); this.set("sentEmail", false); - let username = this.get("username"); + let username = this.username; if (!username) { username = this.currentUser.get("username"); this.set("username", username); } - EmailPreview.findDigest(username, this.get("lastSeen")).then(email => { + EmailPreview.findDigest(username, this.lastSeen).then(email => { model.setProperties( email.getProperties("html_content", "text_content") ); @@ -40,9 +40,9 @@ export default Ember.Controller.extend({ this.set("sentEmail", false); EmailPreview.sendDigest( - this.get("username"), - this.get("lastSeen"), - this.get("email") + this.username, + this.lastSeen, + this.email ) .then(result => { if (result.errors) { diff --git a/app/assets/javascripts/admin/controllers/admin-embedding.js.es6 b/app/assets/javascripts/admin/controllers/admin-embedding.js.es6 index 33240955b55..a8b522130c9 100644 --- a/app/assets/javascripts/admin/controllers/admin-embedding.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-embedding.js.es6 @@ -32,11 +32,11 @@ export default Ember.Controller.extend({ actions: { saveChanges() { - const embedding = this.get("embedding"); + const embedding = this.embedding; const updates = embedding.getProperties(embedding.get("fields")); this.set("saved", false); - this.get("embedding") + this.embedding .update(updates) .then(() => this.set("saved", true)) .catch(popupAjaxError); diff --git a/app/assets/javascripts/admin/controllers/admin-emojis.js.es6 b/app/assets/javascripts/admin/controllers/admin-emojis.js.es6 index 75dc4d9922c..4d7d8d232c6 100644 --- a/app/assets/javascripts/admin/controllers/admin-emojis.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-emojis.js.es6 @@ -6,7 +6,7 @@ export default Ember.Controller.extend({ actions: { emojiUploaded(emoji) { emoji.url += "?t=" + new Date().getTime(); - this.get("model").pushObject(Ember.Object.create(emoji)); + this.model.pushObject(Ember.Object.create(emoji)); }, destroy(emoji) { @@ -19,7 +19,7 @@ export default Ember.Controller.extend({ return ajax("/admin/customize/emojis/" + emoji.get("name"), { type: "DELETE" }).then(() => { - this.get("model").removeObject(emoji); + this.model.removeObject(emoji); }); } } diff --git a/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js.es6 b/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js.es6 index 595a6285720..66ffe3c08c3 100644 --- a/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js.es6 @@ -10,7 +10,7 @@ export default Ember.Controller.extend({ show: debounce(function() { this.set("loading", true); - ScreenedIpAddress.findAll(this.get("filter")).then(result => { + ScreenedIpAddress.findAll(this.filter).then(result => { this.setProperties({ model: result, loading: false }); }); }, 250).observes("filter"), @@ -34,7 +34,7 @@ export default Ember.Controller.extend({ }, cancel(record) { - const savedIpAddress = this.get("savedIpAddress"); + const savedIpAddress = this.savedIpAddress; if (savedIpAddress && record.get("editing")) { record.set("ip_address", savedIpAddress); } @@ -74,7 +74,7 @@ export default Ember.Controller.extend({ .destroy() .then(deleted => { if (deleted) { - this.get("model").removeObject(record); + this.model.removeObject(record); } else { bootbox.alert(I18n.t("generic_error")); } @@ -92,7 +92,7 @@ export default Ember.Controller.extend({ }, recordAdded(arg) { - this.get("model").unshiftObject(arg); + this.model.unshiftObject(arg); }, rollUp() { diff --git a/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6 b/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6 index 9a596ad70f8..f13ac514628 100644 --- a/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6 @@ -11,11 +11,11 @@ export default Ember.Controller.extend({ filtersExists: Ember.computed.gt("filterCount", 0), filterActionIdChanged: function() { - const filterActionId = this.get("filterActionId"); + const filterActionId = this.filterActionId; if (filterActionId) { this._changeFilters({ action_name: filterActionId, - action_id: this.get("userHistoryActions").findBy("id", filterActionId) + action_id: this.userHistoryActions.findBy("id", filterActionId) .action_id }); } @@ -35,7 +35,7 @@ export default Ember.Controller.extend({ _refresh() { this.set("loading", true); - var filters = this.get("filters"), + var filters = this.filters, params = {}, count = 0; @@ -52,7 +52,7 @@ export default Ember.Controller.extend({ StaffActionLog.findAll(params) .then(result => { this.set("model", result.staff_action_logs); - if (this.get("userHistoryActions").length === 0) { + if (this.userHistoryActions.length === 0) { let actionTypes = result.user_history_actions.map(action => { return { id: action.id, @@ -80,7 +80,7 @@ export default Ember.Controller.extend({ }.on("init"), _changeFilters: function(props) { - this.get("filters").setProperties(props); + this.filters.setProperties(props); this.scheduleRefresh(); }, diff --git a/app/assets/javascripts/admin/controllers/admin-permalinks.js.es6 b/app/assets/javascripts/admin/controllers/admin-permalinks.js.es6 index 053882c52ff..45e88514a0f 100644 --- a/app/assets/javascripts/admin/controllers/admin-permalinks.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-permalinks.js.es6 @@ -6,7 +6,7 @@ export default Ember.Controller.extend({ filter: null, show: debounce(function() { - Permalink.findAll(this.get("filter")).then(result => { + Permalink.findAll(this.filter).then(result => { this.set("model", result); this.set("loading", false); }); @@ -14,7 +14,7 @@ export default Ember.Controller.extend({ actions: { recordAdded(arg) { - this.get("model").unshiftObject(arg); + this.model.unshiftObject(arg); }, destroy: function(record) { @@ -27,7 +27,7 @@ export default Ember.Controller.extend({ record.destroy().then( deleted => { if (deleted) { - this.get("model").removeObject(record); + this.model.removeObject(record); } else { bootbox.alert(I18n.t("generic_error")); } diff --git a/app/assets/javascripts/admin/controllers/admin-plugins.js.es6 b/app/assets/javascripts/admin/controllers/admin-plugins.js.es6 index 2e34bfc7f79..36b1f7ca112 100644 --- a/app/assets/javascripts/admin/controllers/admin-plugins.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-plugins.js.es6 @@ -3,7 +3,7 @@ import computed from "ember-addons/ember-computed-decorators"; export default Ember.Controller.extend({ @computed adminRoutes: function() { - return this.get("model") + return this.model .map(p => { if (p.get("enabled")) { return p.admin_route; diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 index 6e4b3546e8b..9575f455425 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 @@ -8,18 +8,18 @@ export default Ember.Controller.extend({ filterContentNow(category) { // If we have no content, don't bother filtering anything - if (!!Ember.isEmpty(this.get("allSiteSettings"))) return; + if (!!Ember.isEmpty(this.allSiteSettings)) return; let filter; - if (this.get("filter")) { - filter = this.get("filter") + if (this.filter) { + filter = this.filter .toLowerCase() .trim(); } - if ((!filter || 0 === filter.length) && !this.get("onlyOverridden")) { - this.set("visibleSiteSettings", this.get("allSiteSettings")); - if (this.get("categoryNameKey") === "all_results") { + if ((!filter || 0 === filter.length) && !this.onlyOverridden) { + this.set("visibleSiteSettings", this.allSiteSettings); + if (this.categoryNameKey === "all_results") { this.transitionToRoute("adminSiteSettings"); } return; @@ -33,9 +33,9 @@ export default Ember.Controller.extend({ const matchesGroupedByCategory = [all]; const matches = []; - this.get("allSiteSettings").forEach(settingsCategory => { + this.allSiteSettings.forEach(settingsCategory => { const siteSettings = settingsCategory.siteSettings.filter(item => { - if (this.get("onlyOverridden") && !item.get("overridden")) return false; + if (this.onlyOverridden && !item.get("overridden")) return false; if (filter) { const setting = item.get("setting").toLowerCase(); return ( @@ -76,7 +76,7 @@ export default Ember.Controller.extend({ }, filterContent: debounce(function() { - if (this.get("_skipBounce")) { + if (this._skipBounce) { this.set("_skipBounce", false); } else { this.filterContentNow(); diff --git a/app/assets/javascripts/admin/controllers/admin-site-text-edit.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-text-edit.js.es6 index eed02e836d0..cb361ed8187 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-text-edit.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-text-edit.js.es6 @@ -6,8 +6,8 @@ export default Ember.Controller.extend(bufferedProperty("siteText"), { actions: { saveChanges() { - const buffered = this.get("buffered"); - this.get("siteText") + const buffered = this.buffered; + this.siteText .save(buffered.getProperties("value")) .then(() => { this.commitBuffer(); @@ -20,10 +20,10 @@ export default Ember.Controller.extend(bufferedProperty("siteText"), { this.set("saved", false); bootbox.confirm(I18n.t("admin.site_text.revert_confirm"), result => { if (result) { - this.get("siteText") + this.siteText .revert() .then(props => { - const buffered = this.get("buffered"); + const buffered = this.buffered; buffered.setProperties(props); this.commitBuffer(); }) diff --git a/app/assets/javascripts/admin/controllers/admin-site-text-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-text-index.js.es6 index 7ef54696491..1c484e4287f 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-text-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-text-index.js.es6 @@ -30,7 +30,7 @@ export default Ember.Controller.extend({ }, search() { - const q = this.get("q"); + const q = this.q; if (q !== lastSearch) { this.set("searching", true); Ember.run.debounce(this, this._performSearch, 400); diff --git a/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 index 06832ca0b60..6b44749f3bc 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 @@ -13,7 +13,7 @@ export default Ember.Controller.extend(GrantBadgeController, { @computed("model", "model.[]", "model.expandedBadges.[]") groupedBadges() { - const allBadges = this.get("model"); + const allBadges = this.model; var grouped = _.groupBy(allBadges, badge => badge.badge_id); @@ -52,22 +52,22 @@ export default Ember.Controller.extend(GrantBadgeController, { actions: { expandGroup: function(userBadge) { - const model = this.get("model"); + const model = this.model; model.set("expandedBadges", model.get("expandedBadges") || []); model.get("expandedBadges").pushObject(userBadge.badge.id); }, grantBadge() { this.grantBadge( - this.get("selectedBadgeId"), + this.selectedBadgeId, this.get("user.username"), - this.get("badgeReason") + this.badgeReason ).then( () => { this.set("badgeReason", ""); Ember.run.next(() => { // Update the selected badge ID after the combobox has re-rendered. - const newSelectedBadge = this.get("grantableBadges")[0]; + const newSelectedBadge = this.grantableBadges[0]; if (newSelectedBadge) { this.set("selectedBadgeId", newSelectedBadge.get("id")); } @@ -87,7 +87,7 @@ export default Ember.Controller.extend(GrantBadgeController, { result => { if (result) { userBadge.revoke().then(() => { - this.get("model").removeObject(userBadge); + this.model.removeObject(userBadge); }); } } diff --git a/app/assets/javascripts/admin/controllers/admin-user-fields.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-fields.js.es6 index f92a8ebd94a..012b91c9dad 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-fields.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-fields.js.es6 @@ -15,13 +15,13 @@ export default Ember.Controller.extend({ field_type: "text", position: MAX_FIELDS }); - this.get("model").pushObject(f); + this.model.pushObject(f); }, moveUp(f) { - const idx = this.get("sortedFields").indexOf(f); + const idx = this.sortedFields.indexOf(f); if (idx) { - const prev = this.get("sortedFields").objectAt(idx - 1); + const prev = this.sortedFields.objectAt(idx - 1); const prevPos = prev.get("position"); prev.update({ position: f.get("position") }); @@ -30,9 +30,9 @@ export default Ember.Controller.extend({ }, moveDown(f) { - const idx = this.get("sortedFields").indexOf(f); + const idx = this.sortedFields.indexOf(f); if (idx > -1) { - const next = this.get("sortedFields").objectAt(idx + 1); + const next = this.sortedFields.objectAt(idx + 1); const nextPos = next.get("position"); next.update({ position: f.get("position") }); @@ -41,7 +41,7 @@ export default Ember.Controller.extend({ }, destroy(f) { - const model = this.get("model"); + const model = this.model; // Only confirm if we already been saved if (f.get("id")) { diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 index 8a697f2de92..c1cfa3d0857 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 @@ -107,16 +107,16 @@ export default Ember.Controller.extend(CanCheckEmails, { }, groupAdded(added) { - this.get("model") + this.model .groupAdded(added) .catch(() => bootbox.alert(I18n.t("generic_error"))); }, groupRemoved(groupId) { - this.get("model") + this.model .groupRemoved(groupId) .then(() => { - if (groupId === this.get("originalPrimaryGroupId")) { + if (groupId === this.originalPrimaryGroupId) { this.set("originalPrimaryGroupId", null); } }) @@ -125,65 +125,65 @@ export default Ember.Controller.extend(CanCheckEmails, { actions: { impersonate() { - return this.get("model").impersonate(); + return this.model.impersonate(); }, logOut() { - return this.get("model").logOut(); + return this.model.logOut(); }, resetBounceScore() { - return this.get("model").resetBounceScore(); + return this.model.resetBounceScore(); }, approve() { - return this.get("model").approve(); + return this.model.approve(); }, deactivate() { - return this.get("model").deactivate(); + return this.model.deactivate(); }, sendActivationEmail() { - return this.get("model").sendActivationEmail(); + return this.model.sendActivationEmail(); }, activate() { - return this.get("model").activate(); + return this.model.activate(); }, revokeAdmin() { - return this.get("model").revokeAdmin(); + return this.model.revokeAdmin(); }, grantAdmin() { - return this.get("model").grantAdmin(); + return this.model.grantAdmin(); }, revokeModeration() { - return this.get("model").revokeModeration(); + return this.model.revokeModeration(); }, grantModeration() { - return this.get("model").grantModeration(); + return this.model.grantModeration(); }, saveTrustLevel() { - return this.get("model").saveTrustLevel(); + return this.model.saveTrustLevel(); }, restoreTrustLevel() { - return this.get("model").restoreTrustLevel(); + return this.model.restoreTrustLevel(); }, lockTrustLevel(locked) { - return this.get("model").lockTrustLevel(locked); + return this.model.lockTrustLevel(locked); }, unsilence() { - return this.get("model").unsilence(); + return this.model.unsilence(); }, silence() { - return this.get("model").silence(); + return this.model.silence(); }, deleteAllPosts() { - return this.get("model").deleteAllPosts(); + return this.model.deleteAllPosts(); }, anonymize() { - return this.get("model").anonymize(); + return this.model.anonymize(); }, disableSecondFactor() { - return this.get("model").disableSecondFactor(); + return this.model.disableSecondFactor(); }, clearPenaltyHistory() { - const user = this.get("model"); + const user = this.model; const path = `/admin/users/${user.get("id")}/penalty_history`; return ajax(path, { type: "DELETE" }) @@ -194,27 +194,27 @@ export default Ember.Controller.extend(CanCheckEmails, { destroy() { const postCount = this.get("model.post_count"); if (postCount <= 5) { - return this.get("model").destroy({ deletePosts: true }); + return this.model.destroy({ deletePosts: true }); } else { - return this.get("model").destroy(); + return this.model.destroy(); } }, viewActionLogs() { - this.get("adminTools").showActionLogs(this, { + this.adminTools.showActionLogs(this, { target_user: this.get("model.username") }); }, showSuspendModal() { - this.get("adminTools").showSuspendModal(this.get("model")); + this.adminTools.showSuspendModal(this.model); }, unsuspend() { - this.get("model") + this.model .unsuspend() .catch(popupAjaxError); }, showSilenceModal() { - this.get("adminTools").showSilenceModal(this.get("model")); + this.adminTools.showSilenceModal(this.model); }, saveUsername(newUsername) { @@ -260,13 +260,13 @@ export default Ember.Controller.extend(CanCheckEmails, { }, generateApiKey() { - this.get("model").generateApiKey(); + this.model.generateApiKey(); }, saveCustomGroups() { - const currentIds = this.get("customGroupIds"); - const bufferedIds = this.get("customGroupIdsBuffer"); - const availableGroups = this.get("availableGroups"); + const currentIds = this.customGroupIds; + const bufferedIds = this.customGroupIdsBuffer; + const availableGroups = this.availableGroups; bufferedIds .filter(id => !currentIds.includes(id)) @@ -294,7 +294,7 @@ export default Ember.Controller.extend(CanCheckEmails, { }, resetPrimaryGroup() { - this.set("model.primary_group_id", this.get("originalPrimaryGroupId")); + this.set("model.primary_group_id", this.originalPrimaryGroupId); }, regenerateApiKey() { @@ -304,7 +304,7 @@ export default Ember.Controller.extend(CanCheckEmails, { I18n.t("yes_value"), result => { if (result) { - this.get("model").generateApiKey(); + this.model.generateApiKey(); } } ); @@ -317,7 +317,7 @@ export default Ember.Controller.extend(CanCheckEmails, { I18n.t("yes_value"), result => { if (result) { - this.get("model").revokeApiKey(); + this.model.revokeApiKey(); } } ); diff --git a/app/assets/javascripts/admin/controllers/admin-users-list-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-users-list-show.js.es6 index f23fa949579..2b5a727730e 100644 --- a/app/assets/javascripts/admin/controllers/admin-users-list-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-users-list-show.js.es6 @@ -27,11 +27,11 @@ export default Ember.Controller.extend(CanCheckEmails, { _refreshUsers() { this.set("refreshing", true); - AdminUser.findAll(this.get("query"), { - filter: this.get("listFilter"), - show_emails: this.get("showEmails"), - order: this.get("order"), - ascending: this.get("ascending") + AdminUser.findAll(this.query, { + filter: this.listFilter, + show_emails: this.showEmails, + order: this.order, + ascending: this.ascending }) .then(result => this.set("model", result)) .finally(() => this.set("refreshing", false)); diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 index 41a9e4a7556..2e38279b54d 100644 --- a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 @@ -39,7 +39,7 @@ export default Ember.Controller.extend({ actions: { recordAdded(arg) { - const a = this.findAction(this.get("actionNameKey")); + const a = this.findAction(this.actionNameKey); if (a) { a.words.unshiftObject(arg); a.incrementProperty("count"); @@ -49,7 +49,7 @@ export default Ember.Controller.extend({ this.get("adminWatchedWords.model").forEach(action => { if (match) return; - if (action.nameKey !== this.get("actionNameKey")) { + if (action.nameKey !== this.actionNameKey) { match = action.words.findBy("id", arg.id); if (match) { action.words.removeObject(match); @@ -62,7 +62,7 @@ export default Ember.Controller.extend({ }, recordRemoved(arg) { - const a = this.findAction(this.get("actionNameKey")); + const a = this.findAction(this.actionNameKey); if (a) { a.words.removeObject(arg); a.decrementProperty("count"); diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words.js.es6 b/app/assets/javascripts/admin/controllers/admin-watched-words.js.es6 index 26538938ac4..20ed6117817 100644 --- a/app/assets/javascripts/admin/controllers/admin-watched-words.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-watched-words.js.es6 @@ -8,21 +8,21 @@ export default Ember.Controller.extend({ regularExpressions: null, filterContentNow() { - if (!!Ember.isEmpty(this.get("allWatchedWords"))) return; + if (!!Ember.isEmpty(this.allWatchedWords)) return; let filter; - if (this.get("filter")) { - filter = this.get("filter").toLowerCase(); + if (this.filter) { + filter = this.filter.toLowerCase(); } if (filter === undefined || filter.length < 1) { - this.set("model", this.get("allWatchedWords")); + this.set("model", this.allWatchedWords); return; } const matchesByAction = []; - this.get("allWatchedWords").forEach(wordsForAction => { + this.allWatchedWords.forEach(wordsForAction => { const wordRecords = wordsForAction.words.filter(wordRecord => { return wordRecord.word.indexOf(filter) > -1; }); @@ -41,7 +41,7 @@ export default Ember.Controller.extend({ filterContent: debounce(function() { this.filterContentNow(); - this.set("filtered", !Ember.isEmpty(this.get("filter"))); + this.set("filtered", !Ember.isEmpty(this.filter)); }, 250).observes("filter"), actions: { diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js.es6 b/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js.es6 index 2d0ee100805..d8c233d88ad 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js.es6 @@ -29,7 +29,7 @@ export default Ember.Controller.extend({ }, _addIncoming(eventId) { - const incomingEventIds = this.get("incomingEventIds"); + const incomingEventIds = this.incomingEventIds; if (incomingEventIds.indexOf(eventId) === -1) { incomingEventIds.pushObject(eventId); @@ -38,7 +38,7 @@ export default Ember.Controller.extend({ actions: { loadMore() { - this.get("model").loadMore(); + this.model.loadMore(); }, ping() { @@ -60,12 +60,12 @@ export default Ember.Controller.extend({ ajax(`/admin/api/web_hooks/${webHookId}/events/bulk`, { type: "GET", - data: { ids: this.get("incomingEventIds") } + data: { ids: this.incomingEventIds } }).then(data => { const objects = data.map(event => this.store.createRecord("web-hook-event", event) ); - this.get("model").unshiftObjects(objects); + this.model.unshiftObjects(objects); this.set("incomingEventIds", []); }); } diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 index a2bbd6149ce..6e44b15d7b2 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 @@ -84,7 +84,7 @@ export default Ember.Controller.extend({ this.set("saved", false); const url = this.get("model.payload_url"); const domain = extractDomainFromUrl(url); - const model = this.get("model"); + const model = this.model; const isNew = model.get("isNew"); const saveWebHook = () => { @@ -92,7 +92,7 @@ export default Ember.Controller.extend({ .save() .then(() => { this.set("saved", true); - this.get("adminWebHooks") + this.adminWebHooks .get("model") .addObject(model); @@ -131,11 +131,11 @@ export default Ember.Controller.extend({ I18n.t("yes_value"), result => { if (result) { - const model = this.get("model"); + const model = this.model; model .destroyRecord() .then(() => { - this.get("adminWebHooks") + this.adminWebHooks .get("model") .removeObject(model); this.transitionToRoute("adminWebHooks"); diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks.js.es6 b/app/assets/javascripts/admin/controllers/admin-web-hooks.js.es6 index 87ed7047849..696541c1cf8 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks.js.es6 @@ -12,7 +12,7 @@ export default Ember.Controller.extend({ webhook .destroyRecord() .then(() => { - this.get("model").removeObject(webhook); + this.model.removeObject(webhook); }) .catch(popupAjaxError); } @@ -21,7 +21,7 @@ export default Ember.Controller.extend({ }, loadMore() { - this.get("model").loadMore(); + this.model.loadMore(); } } }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 index 3a94394e7b6..73f1f1e11ff 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 @@ -103,7 +103,7 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { updateName() { - let name = this.get("name"); + let name = this.name; if (Ember.isEmpty(name)) { name = $("#file-input")[0].files[0].name; this.set("name", name.split(".")[0]); @@ -123,14 +123,14 @@ export default Ember.Controller.extend(ModalFunctionality, { options.data.append("file", file); - ajax(this.get("uploadUrl"), options) + ajax(this.uploadUrl, options) .then(result => { const upload = { upload_id: result.upload_id, - name: this.get("name"), + name: this.name, original_filename: file.name }; - this.get("adminCustomizeThemesShow").send("addUpload", upload); + this.adminCustomizeThemesShow.send("addUpload", upload); this.send("closeModal"); }) .catch(e => { diff --git a/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js.es6 index 633bd37e900..374b6392f4a 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js.es6 @@ -5,9 +5,9 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { selectBase() { - this.get("adminCustomizeColors").send( + this.adminCustomizeColors.send( "newColorSchemeWithBase", - this.get("selectedBaseThemeId") + this.selectedBaseThemeId ); this.send("closeModal"); } diff --git a/app/assets/javascripts/admin/controllers/modals/admin-edit-badge-groupings.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-edit-badge-groupings.js.es6 index 63dac2a1ec7..76dc4c07d74 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-edit-badge-groupings.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-edit-badge-groupings.js.es6 @@ -5,7 +5,7 @@ import { observes } from "ember-addons/ember-computed-decorators"; export default Ember.Controller.extend(ModalFunctionality, { @observes("model") modelChanged() { - const model = this.get("model"); + const model = this.model; const copy = Ember.A(); const store = this.store; @@ -19,7 +19,7 @@ export default Ember.Controller.extend(ModalFunctionality, { }, moveItem(item, delta) { - const copy = this.get("workingCopy"); + const copy = this.workingCopy; const index = copy.indexOf(item); if (index + delta < 0 || index + delta >= copy.length) { return; @@ -37,7 +37,7 @@ export default Ember.Controller.extend(ModalFunctionality, { this.moveItem(item, 1); }, delete(item) { - this.get("workingCopy").removeObject(item); + this.workingCopy.removeObject(item); }, cancel() { this.setProperties({ model: null, workingCopy: null }); @@ -54,10 +54,10 @@ export default Ember.Controller.extend(ModalFunctionality, { editing: true, name: I18n.t("admin.badges.badge_grouping") }); - this.get("workingCopy").pushObject(obj); + this.workingCopy.pushObject(obj); }, saveAll() { - let items = this.get("workingCopy"); + let items = this.workingCopy; const groupIds = items.map(i => i.get("id") || -1); const names = items.map(i => i.get("name")); @@ -66,7 +66,7 @@ export default Ember.Controller.extend(ModalFunctionality, { method: "POST" }).then( data => { - items = this.get("model"); + items = this.model; items.clear(); data.badge_groupings.forEach(g => { items.pushObject(this.store.createRecord("badge-grouping", g)); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 index d1e9fc71a3f..bde1d91e6ca 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 @@ -166,14 +166,14 @@ export default Ember.Controller.extend(ModalFunctionality, { @observes("privateChecked") privateWasChecked() { - this.get("privateChecked") + this.privateChecked ? this.set("urlPlaceholder", "git@github.com:discourse/sample_theme.git") : this.set("urlPlaceholder", "https://github.com/discourse/sample_theme"); - const checked = this.get("privateChecked"); + const checked = this.privateChecked; if (checked && !this._keyLoading) { this._keyLoading = true; - ajax(this.get("keyGenUrl"), { method: "POST" }) + ajax(this.keyGenUrl, { method: "POST" }) .then(pair => { this.setProperties({ privateKey: pair.private_key, @@ -228,13 +228,13 @@ export default Ember.Controller.extend(ModalFunctionality, { }, installTheme() { - if (this.get("create")) { + if (this.create) { this.set("loading", true); - const theme = this.store.createRecord(this.get("recordType")); + const theme = this.store.createRecord(this.recordType); theme - .save({ name: this.get("name"), component: this.get("component") }) + .save({ name: this.name, component: this.component }) .then(() => { - this.get("themesController").send("addTheme", theme); + this.themesController.send("addTheme", theme); this.send("closeModal"); }) .catch(popupAjaxError) @@ -247,21 +247,21 @@ export default Ember.Controller.extend(ModalFunctionality, { type: "POST" }; - if (this.get("local")) { + if (this.local) { options.processData = false; options.contentType = false; options.data = new FormData(); - options.data.append("theme", this.get("localFile")); + options.data.append("theme", this.localFile); } - if (this.get("remote") || this.get("popular")) { + if (this.remote || this.popular) { options.data = { - remote: this.get("uploadUrl"), - branch: this.get("branch") + remote: this.uploadUrl, + branch: this.branch }; - if (this.get("privateChecked")) { - options.data.private_key = this.get("privateKey"); + if (this.privateChecked) { + options.data.private_key = this.privateKey; } } @@ -271,13 +271,13 @@ export default Ember.Controller.extend(ModalFunctionality, { } this.set("loading", true); - ajax(this.get("importUrl"), options) + ajax(this.importUrl, options) .then(result => { const theme = this.store.createRecord( - this.get("recordType"), + this.recordType, result.theme ); - this.get("adminCustomizeThemes").send("addTheme", theme); + this.adminCustomizeThemes.send("addTheme", theme); this.send("closeModal"); }) .then(() => { diff --git a/app/assets/javascripts/admin/controllers/modals/admin-silence-user.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-silence-user.js.es6 index 40b3aa640ff..79ec3e69454 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-silence-user.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-silence-user.js.es6 @@ -19,19 +19,19 @@ export default Ember.Controller.extend(PenaltyController, { actions: { silence() { - if (this.get("submitDisabled")) { + if (this.submitDisabled) { return; } this.set("silencing", true); this.penalize(() => { - return this.get("user").silence({ - silenced_till: this.get("silenceUntil"), - reason: this.get("reason"), - message: this.get("message"), - post_id: this.get("postId"), - post_action: this.get("postAction"), - post_edit: this.get("postEdit") + return this.user.silence({ + silenced_till: this.silenceUntil, + reason: this.reason, + message: this.message, + post_id: this.postId, + post_action: this.postAction, + post_edit: this.postEdit }); }).finally(() => this.set("silencing", false)); } diff --git a/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js.es6 index 180b470d492..c5911322c59 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js.es6 @@ -19,20 +19,20 @@ export default Ember.Controller.extend(PenaltyController, { actions: { suspend() { - if (this.get("submitDisabled")) { + if (this.submitDisabled) { return; } this.set("suspending", true); this.penalize(() => { - return this.get("user").suspend({ - suspend_until: this.get("suspendUntil"), - reason: this.get("reason"), - message: this.get("message"), - post_id: this.get("postId"), - post_action: this.get("postAction"), - post_edit: this.get("postEdit") + return this.user.suspend({ + suspend_until: this.suspendUntil, + reason: this.reason, + message: this.message, + post_id: this.postId, + post_action: this.postAction, + post_edit: this.postEdit }); }).finally(() => this.set("suspending", false)); } diff --git a/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.js.es6 index 671e96cfabb..22aa327651a 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.js.es6 @@ -11,15 +11,15 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { uploadDone({ url }) { - this.get("images").addObject(url); + this.images.addObject(url); }, remove(url) { - this.get("images").removeObject(url); + this.images.removeObject(url); }, close() { - this.save(this.get("images").join("\n")); + this.save(this.images.join("\n")); this.send("closeModal"); } } diff --git a/app/assets/javascripts/admin/mixins/penalty-controller.js.es6 b/app/assets/javascripts/admin/mixins/penalty-controller.js.es6 index efa71a2bebd..b38e249da37 100644 --- a/app/assets/javascripts/admin/mixins/penalty-controller.js.es6 +++ b/app/assets/javascripts/admin/mixins/penalty-controller.js.es6 @@ -24,14 +24,14 @@ export default Ember.Mixin.create(ModalFunctionality, { }, penalize(cb) { - let before = this.get("before"); + let before = this.before; let promise = before ? before() : Ember.RSVP.resolve(); return promise .then(() => cb()) .then(result => { this.send("closeModal"); - let callback = this.get("successCallback"); + let callback = this.successCallback; if (callback) { callback(result); } diff --git a/app/assets/javascripts/admin/mixins/setting-object.js.es6 b/app/assets/javascripts/admin/mixins/setting-object.js.es6 index ce3a217a98a..ef047af7327 100644 --- a/app/assets/javascripts/admin/mixins/setting-object.js.es6 +++ b/app/assets/javascripts/admin/mixins/setting-object.js.es6 @@ -12,7 +12,7 @@ export default Ember.Mixin.create({ @computed("valid_values") validValues(validValues) { const vals = [], - translateNames = this.get("translate_names"); + translateNames = this.translate_names; validValues.forEach(v => { if (v.name && v.name.length > 0 && translateNames) { diff --git a/app/assets/javascripts/admin/models/admin-user.js.es6 b/app/assets/javascripts/admin/models/admin-user.js.es6 index 1f0738ebfa2..f5ff4c2761b 100644 --- a/app/assets/javascripts/admin/models/admin-user.js.es6 +++ b/app/assets/javascripts/admin/models/admin-user.js.es6 @@ -76,15 +76,15 @@ const AdminUser = Discourse.User.extend({ return ajax(`/admin/users/${this.id}/groups`, { type: "POST", data: { group_id: added.id } - }).then(() => this.get("groups").pushObject(added)); + }).then(() => this.groups.pushObject(added)); }, groupRemoved(groupId) { return ajax(`/admin/users/${this.id}/groups/${groupId}`, { type: "DELETE" }).then(() => { - this.set("groups.[]", this.get("groups").rejectBy("id", groupId)); - if (this.get("primary_group_id") === groupId) { + this.set("groups.[]", this.groups.rejectBy("id", groupId)); + if (this.primary_group_id === groupId) { this.set("primary_group_id", null); } }); @@ -240,7 +240,7 @@ const AdminUser = Discourse.User.extend({ }, setOriginalTrustLevel() { - this.set("originalTrustLevel", this.get("trust_level")); + this.set("originalTrustLevel", this.trust_level); }, dirty: propertyNotEqual("originalTrustLevel", "trustLevel.id"), @@ -266,7 +266,7 @@ const AdminUser = Discourse.User.extend({ }, restoreTrustLevel() { - this.set("trustLevel.id", this.get("originalTrustLevel")); + this.set("trustLevel.id", this.originalTrustLevel); }, lockTrustLevel(locked) { @@ -316,14 +316,14 @@ const AdminUser = Discourse.User.extend({ logOut() { return ajax("/admin/users/" + this.id + "/log_out", { type: "POST", - data: { username_or_email: this.get("username") } + data: { username_or_email: this.username } }).then(() => bootbox.alert(I18n.t("admin.user.logged_out"))); }, impersonate() { return ajax("/admin/impersonate", { type: "POST", - data: { username_or_email: this.get("username") } + data: { username_or_email: this.username } }) .then(() => (document.location = Discourse.getURL("/"))) .catch(e => { @@ -397,7 +397,7 @@ const AdminUser = Discourse.User.extend({ sendActivationEmail() { return ajax(userPath("action/send_activation_email"), { type: "POST", - data: { username: this.get("username") } + data: { username: this.username } }) .then(() => bootbox.alert(I18n.t("admin.user.activation_email_sent"))) .catch(popupAjaxError); @@ -518,7 +518,7 @@ const AdminUser = Discourse.User.extend({ }, loadDetails() { - if (this.get("loadedDetails")) { + if (this.loadedDetails) { return Ember.RSVP.resolve(this); } diff --git a/app/assets/javascripts/admin/models/api-key.js.es6 b/app/assets/javascripts/admin/models/api-key.js.es6 index 4b0eb655cae..62a4e003bfc 100644 --- a/app/assets/javascripts/admin/models/api-key.js.es6 +++ b/app/assets/javascripts/admin/models/api-key.js.es6 @@ -8,7 +8,7 @@ const ApiKey = Discourse.Model.extend({ regenerate() { return ajax(KEY_ENDPOINT, { type: "PUT", - data: { id: this.get("id") } + data: { id: this.id } }).then(result => { this.set("key", result.api_key.key); return this; @@ -18,7 +18,7 @@ const ApiKey = Discourse.Model.extend({ revoke() { return ajax(KEY_ENDPOINT, { type: "DELETE", - data: { id: this.get("id") } + data: { id: this.id } }); } }); diff --git a/app/assets/javascripts/admin/models/backup.js.es6 b/app/assets/javascripts/admin/models/backup.js.es6 index b79230829e5..7dc945d1ae9 100644 --- a/app/assets/javascripts/admin/models/backup.js.es6 +++ b/app/assets/javascripts/admin/models/backup.js.es6 @@ -3,11 +3,11 @@ import { extractError } from "discourse/lib/ajax-error"; const Backup = Discourse.Model.extend({ destroy() { - return ajax("/admin/backups/" + this.get("filename"), { type: "DELETE" }); + return ajax("/admin/backups/" + this.filename, { type: "DELETE" }); }, restore() { - return ajax("/admin/backups/" + this.get("filename") + "/restore", { + return ajax("/admin/backups/" + this.filename + "/restore", { type: "POST", data: { client_id: window.MessageBus.clientId } }); diff --git a/app/assets/javascripts/admin/models/color-scheme-color.js.es6 b/app/assets/javascripts/admin/models/color-scheme-color.js.es6 index 3cda49fe1d5..970b1cfe90c 100644 --- a/app/assets/javascripts/admin/models/color-scheme-color.js.es6 +++ b/app/assets/javascripts/admin/models/color-scheme-color.js.es6 @@ -8,7 +8,7 @@ import { propertyNotEqual, i18n } from "discourse/lib/computed"; const ColorSchemeColor = Discourse.Model.extend({ @on("init") startTrackingChanges() { - this.set("originals", { hex: this.get("hex") || "FFFFFF" }); + this.set("originals", { hex: this.hex || "FFFFFF" }); // force changed property to be recalculated this.notifyPropertyChange("hex"); @@ -17,8 +17,8 @@ const ColorSchemeColor = Discourse.Model.extend({ // Whether value has changed since it was last saved. @computed("hex") changed(hex) { - if (!this.get("originals")) return false; - if (hex !== this.get("originals").hex) return true; + if (!this.originals) return false; + if (hex !== this.originals.hex) return true; return false; }, @@ -29,16 +29,16 @@ const ColorSchemeColor = Discourse.Model.extend({ // Whether the saved value is different than Discourse's default color scheme. @computed("default_hex", "hex") savedIsOverriden(defaultHex) { - return this.get("originals").hex !== defaultHex; + return this.originals.hex !== defaultHex; }, revert() { - this.set("hex", this.get("default_hex")); + this.set("hex", this.default_hex); }, undo() { - if (this.get("originals")) { - this.set("hex", this.get("originals").hex); + if (this.originals) { + this.set("hex", this.originals.hex); } }, @@ -75,10 +75,10 @@ const ColorSchemeColor = Discourse.Model.extend({ @observes("hex") hexValueChanged() { - if (this.get("hex")) { + if (this.hex) { this.set( "hex", - this.get("hex") + this.hex .toString() .replace(/[^0-9a-fA-F]/g, "") ); diff --git a/app/assets/javascripts/admin/models/email-template.js.es6 b/app/assets/javascripts/admin/models/email-template.js.es6 index 80827c90630..2dddb272dc3 100644 --- a/app/assets/javascripts/admin/models/email-template.js.es6 +++ b/app/assets/javascripts/admin/models/email-template.js.es6 @@ -4,7 +4,7 @@ const { getProperties } = Ember; export default RestModel.extend({ revert() { - return ajax(`/admin/customize/email_templates/${this.get("id")}`, { + return ajax(`/admin/customize/email_templates/${this.id}`, { method: "DELETE" }).then(result => getProperties(result.email_template, "subject", "body", "can_revert") diff --git a/app/assets/javascripts/admin/models/permalink.js.es6 b/app/assets/javascripts/admin/models/permalink.js.es6 index 6603826d810..9019bdbc30b 100644 --- a/app/assets/javascripts/admin/models/permalink.js.es6 +++ b/app/assets/javascripts/admin/models/permalink.js.es6 @@ -4,15 +4,15 @@ const Permalink = Discourse.Model.extend({ return ajax("/admin/permalinks.json", { type: "POST", data: { - url: this.get("url"), - permalink_type: this.get("permalink_type"), - permalink_type_value: this.get("permalink_type_value") + url: this.url, + permalink_type: this.permalink_type, + permalink_type_value: this.permalink_type_value } }); }, destroy: function() { - return ajax("/admin/permalinks/" + this.get("id") + ".json", { + return ajax("/admin/permalinks/" + this.id + ".json", { type: "DELETE" }); } diff --git a/app/assets/javascripts/admin/models/report.js.es6 b/app/assets/javascripts/admin/models/report.js.es6 index 0f030b509ba..cbe397df987 100644 --- a/app/assets/javascripts/admin/models/report.js.es6 +++ b/app/assets/javascripts/admin/models/report.js.es6 @@ -69,7 +69,7 @@ const Report = Discourse.Model.extend({ count++; } }); - if (this.get("method") === "average" && count > 0) { + if (this.method === "average" && count > 0) { sum /= count; } return round(sum, -2); @@ -107,7 +107,7 @@ const Report = Discourse.Model.extend({ }, averageCount(count, value) { - return this.get("average") ? value / count : value; + return this.average ? value / count : value; }, @computed("yesterdayCount", "higher_is_better") @@ -158,7 +158,7 @@ const Report = Discourse.Model.extend({ @computed("prev_period", "currentTotal", "currentAverage", "higher_is_better") trend(prev, currentTotal, currentAverage, higherIsBetter) { - const total = this.get("average") ? currentAverage : currentTotal; + const total = this.average ? currentAverage : currentTotal; return this._computeTrend(prev, total, higherIsBetter); }, @@ -190,12 +190,12 @@ const Report = Discourse.Model.extend({ @computed("prev_period", "currentTotal", "currentAverage") trendTitle(prev, currentTotal, currentAverage) { - let current = this.get("average") ? currentAverage : currentTotal; + let current = this.average ? currentAverage : currentTotal; let percent = this.percentChangeString(prev, current); - if (this.get("average")) { + if (this.average) { prev = prev ? prev.toFixed(1) : "0"; - if (this.get("percent")) { + if (this.percent) { current += "%"; prev += "%"; } @@ -246,7 +246,7 @@ const Report = Discourse.Model.extend({ @computed("data") sortedData(data) { - return this.get("xAxisIsDate") ? data.toArray().reverse() : data.toArray(); + return this.xAxisIsDate ? data.toArray().reverse() : data.toArray(); }, @computed("data") diff --git a/app/assets/javascripts/admin/models/screened-email.js.es6 b/app/assets/javascripts/admin/models/screened-email.js.es6 index 23b4ec28c79..6eb014c4849 100644 --- a/app/assets/javascripts/admin/models/screened-email.js.es6 +++ b/app/assets/javascripts/admin/models/screened-email.js.es6 @@ -8,7 +8,7 @@ const ScreenedEmail = Discourse.Model.extend({ }, clearBlock: function() { - return ajax("/admin/logs/screened_emails/" + this.get("id"), { + return ajax("/admin/logs/screened_emails/" + this.id, { method: "DELETE" }); } diff --git a/app/assets/javascripts/admin/models/screened-ip-address.js.es6 b/app/assets/javascripts/admin/models/screened-ip-address.js.es6 index 68514a81e54..6aa5a8074d0 100644 --- a/app/assets/javascripts/admin/models/screened-ip-address.js.es6 +++ b/app/assets/javascripts/admin/models/screened-ip-address.js.es6 @@ -22,8 +22,8 @@ const ScreenedIpAddress = Discourse.Model.extend({ { type: this.id ? "PUT" : "POST", data: { - ip_address: this.get("ip_address"), - action_name: this.get("action_name") + ip_address: this.ip_address, + action_name: this.action_name } } ); @@ -31,7 +31,7 @@ const ScreenedIpAddress = Discourse.Model.extend({ destroy() { return ajax( - "/admin/logs/screened_ip_addresses/" + this.get("id") + ".json", + "/admin/logs/screened_ip_addresses/" + this.id + ".json", { type: "DELETE" } ); } diff --git a/app/assets/javascripts/admin/models/site-text.js.es6 b/app/assets/javascripts/admin/models/site-text.js.es6 index c7e0d3d7a59..8bcb8c7f0f9 100644 --- a/app/assets/javascripts/admin/models/site-text.js.es6 +++ b/app/assets/javascripts/admin/models/site-text.js.es6 @@ -4,7 +4,7 @@ const { getProperties } = Ember; export default RestModel.extend({ revert() { - return ajax(`/admin/customize/site_texts/${this.get("id")}`, { + return ajax(`/admin/customize/site_texts/${this.id}`, { method: "DELETE" }).then(result => getProperties(result.site_text, "value", "can_revert")); } diff --git a/app/assets/javascripts/admin/models/theme.js.es6 b/app/assets/javascripts/admin/models/theme.js.es6 index 19162b7ec3a..3fae52ccc48 100644 --- a/app/assets/javascripts/admin/models/theme.js.es6 +++ b/app/assets/javascripts/admin/models/theme.js.es6 @@ -56,7 +56,7 @@ const Theme = RestModel.extend({ "footer" ]; - const scss_fields = (this.get("theme_fields") || []) + const scss_fields = (this.theme_fields || []) .filter(f => f.target === "extra_scss" && f.name !== "") .map(f => f.name); @@ -71,7 +71,7 @@ const Theme = RestModel.extend({ settings: ["yaml"], translations: [ "en", - ...(this.get("theme_fields") || []) + ...(this.theme_fields || []) .filter(f => f.target === "translations" && f.name !== "en") .map(f => f.name) ], @@ -118,7 +118,7 @@ const Theme = RestModel.extend({ let hash = {}; fields.forEach(field => { - if (!field.type_id || this.get("FIELDS_IDS").includes(field.type_id)) { + if (!field.type_id || this.FIELDS_IDS.includes(field.type_id)) { hash[this.getKey(field)] = field; } }); @@ -162,7 +162,7 @@ const Theme = RestModel.extend({ if (name) { return !Ember.isEmpty(this.getField(target, name)); } else { - let fields = this.get("theme_fields") || []; + let fields = this.theme_fields || []; return fields.any( field => field.target === target && !Ember.isEmpty(field.value) ); @@ -170,20 +170,20 @@ const Theme = RestModel.extend({ }, hasError(target, name) { - return this.get("theme_fields") + return this.theme_fields .filter(f => f.target === target && (!name || name === f.name)) .any(f => f.error); }, getError(target, name) { - let themeFields = this.get("themeFields"); + let themeFields = this.themeFields; let key = this.getKey({ target, name }); let field = themeFields[key]; return field ? field.error : ""; }, getField(target, name) { - let themeFields = this.get("themeFields"); + let themeFields = this.themeFields; let key = this.getKey({ target, name }); let field = themeFields[key]; return field ? field.value : ""; @@ -200,12 +200,12 @@ const Theme = RestModel.extend({ setField(target, name, value, upload_id, type_id) { this.set("changed", true); - let themeFields = this.get("themeFields"); + let themeFields = this.themeFields; let field = { name, target, value, upload_id, type_id }; // slow path for uploads and so on if (type_id && type_id > 1) { - let fields = this.get("theme_fields"); + let fields = this.theme_fields; let existing = fields.find( f => f.target === target && f.name === name && f.type_id === type_id ); @@ -246,13 +246,13 @@ const Theme = RestModel.extend({ }, removeChildTheme(theme) { - const childThemes = this.get("childThemes"); + const childThemes = this.childThemes; childThemes.removeObject(theme); return this.saveChanges("child_theme_ids"); }, addChildTheme(theme) { - let childThemes = this.get("childThemes"); + let childThemes = this.childThemes; if (!childThemes) { childThemes = []; this.set("childThemes", childThemes); diff --git a/app/assets/javascripts/admin/models/tl3-requirements.js.es6 b/app/assets/javascripts/admin/models/tl3-requirements.js.es6 index c30bc0404d5..bf77f752aea 100644 --- a/app/assets/javascripts/admin/models/tl3-requirements.js.es6 +++ b/app/assets/javascripts/admin/models/tl3-requirements.js.es6 @@ -44,30 +44,30 @@ export default Discourse.Model.extend({ ) met() { return { - days_visited: this.get("days_visited") >= this.get("min_days_visited"), + days_visited: this.days_visited >= this.min_days_visited, topics_replied_to: - this.get("num_topics_replied_to") >= this.get("min_topics_replied_to"), - topics_viewed: this.get("topics_viewed") >= this.get("min_topics_viewed"), - posts_read: this.get("posts_read") >= this.get("min_posts_read"), + this.num_topics_replied_to >= this.min_topics_replied_to, + topics_viewed: this.topics_viewed >= this.min_topics_viewed, + posts_read: this.posts_read >= this.min_posts_read, topics_viewed_all_time: - this.get("topics_viewed_all_time") >= - this.get("min_topics_viewed_all_time"), + this.topics_viewed_all_time >= + this.min_topics_viewed_all_time, posts_read_all_time: - this.get("posts_read_all_time") >= this.get("min_posts_read_all_time"), + this.posts_read_all_time >= this.min_posts_read_all_time, flagged_posts: - this.get("num_flagged_posts") <= this.get("max_flagged_posts"), + this.num_flagged_posts <= this.max_flagged_posts, flagged_by_users: - this.get("num_flagged_by_users") <= this.get("max_flagged_by_users"), - likes_given: this.get("num_likes_given") >= this.get("min_likes_given"), + this.num_flagged_by_users <= this.max_flagged_by_users, + likes_given: this.num_likes_given >= this.min_likes_given, likes_received: - this.get("num_likes_received") >= this.get("min_likes_received"), + this.num_likes_received >= this.min_likes_received, likes_received_days: - this.get("num_likes_received_days") >= - this.get("min_likes_received_days"), + this.num_likes_received_days >= + this.min_likes_received_days, likes_received_users: - this.get("num_likes_received_users") >= - this.get("min_likes_received_users"), - level_locked: this.get("trust_level_locked"), + this.num_likes_received_users >= + this.min_likes_received_users, + level_locked: this.trust_level_locked, silenced: this.get("penalty_counts.silenced") === 0, suspended: this.get("penalty_counts.suspended") === 0 }; diff --git a/app/assets/javascripts/admin/models/watched-word.js.es6 b/app/assets/javascripts/admin/models/watched-word.js.es6 index d7d781227dd..03404e7de03 100644 --- a/app/assets/javascripts/admin/models/watched-word.js.es6 +++ b/app/assets/javascripts/admin/models/watched-word.js.es6 @@ -6,14 +6,14 @@ const WatchedWord = Discourse.Model.extend({ "/admin/logs/watched_words" + (this.id ? "/" + this.id : "") + ".json", { type: this.id ? "PUT" : "POST", - data: { word: this.get("word"), action_key: this.get("action") }, + data: { word: this.word, action_key: this.action }, dataType: "json" } ); }, destroy() { - return ajax("/admin/logs/watched_words/" + this.get("id") + ".json", { + return ajax("/admin/logs/watched_words/" + this.id + ".json", { type: "DELETE" }); } diff --git a/app/assets/javascripts/admin/models/web-hook.js.es6 b/app/assets/javascripts/admin/models/web-hook.js.es6 index a2a7ae79fb7..cc35f474371 100644 --- a/app/assets/javascripts/admin/models/web-hook.js.es6 +++ b/app/assets/javascripts/admin/models/web-hook.js.es6 @@ -32,7 +32,7 @@ export default RestModel.extend({ @observes("group_ids") updateGroupsFilter() { - const groupIds = this.get("group_ids"); + const groupIds = this.group_ids; this.set( "groupsFilterInName", Discourse.Site.currentProp("groups").reduce((groupNames, g) => { @@ -61,23 +61,23 @@ export default RestModel.extend({ }, createProperties() { - const types = this.get("web_hook_event_types"); - const categoryIds = this.get("categories").map(c => c.id); - const tagNames = this.get("tag_names"); + const types = this.web_hook_event_types; + const categoryIds = this.categories.map(c => c.id); + const tagNames = this.tag_names; // Hack as {{group-selector}} accepts a comma-separated string as data source, but // we use an array to populate the datasource above. - const groupsFilter = this.get("groupsFilterInName"); + const groupsFilter = this.groupsFilterInName; const groupNames = typeof groupsFilter === "string" ? groupsFilter.split(",") : groupsFilter; return { - payload_url: this.get("payload_url"), - content_type: this.get("content_type"), - secret: this.get("secret"), - wildcard_web_hook: this.get("wildcard_web_hook"), - verify_certificate: this.get("verify_certificate"), - active: this.get("active"), + payload_url: this.payload_url, + content_type: this.content_type, + secret: this.secret, + wildcard_web_hook: this.wildcard_web_hook, + verify_certificate: this.verify_certificate, + active: this.active, web_hook_event_type_ids: Ember.isEmpty(types) ? [null] : types.map(type => type.id), diff --git a/app/assets/javascripts/admin/routes/admin-customize-themes-edit.js.es6 b/app/assets/javascripts/admin/routes/admin-customize-themes-edit.js.es6 index 818a75e6e4f..2e37bdc1ced 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-themes-edit.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-customize-themes-edit.js.es6 @@ -42,7 +42,7 @@ export default Ember.Route.extend({ willTransition(transition) { if ( this.get("controller.model.changed") && - this.get("shouldAlertUnsavedChanges") && + this.shouldAlertUnsavedChanges && transition.intent.name !== this.routeName ) { transition.abort(); diff --git a/app/assets/javascripts/admin/routes/admin-email-incomings.js.es6 b/app/assets/javascripts/admin/routes/admin-email-incomings.js.es6 index 9c128333e76..79331282bbb 100644 --- a/app/assets/javascripts/admin/routes/admin-email-incomings.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-email-incomings.js.es6 @@ -2,11 +2,11 @@ import IncomingEmail from "admin/models/incoming-email"; export default Discourse.Route.extend({ model() { - return IncomingEmail.findAll({ status: this.get("status") }); + return IncomingEmail.findAll({ status: this.status }); }, setupController(controller, model) { controller.set("model", model); - controller.set("filter", { status: this.get("status") }); + controller.set("filter", { status: this.status }); } }); diff --git a/app/assets/javascripts/admin/routes/admin-email-logs.js.es6 b/app/assets/javascripts/admin/routes/admin-email-logs.js.es6 index 35d2c51e8ac..7813fb93fde 100644 --- a/app/assets/javascripts/admin/routes/admin-email-logs.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-email-logs.js.es6 @@ -2,7 +2,7 @@ export default Discourse.Route.extend({ setupController(controller) { controller.setProperties({ loading: true, - filter: { status: this.get("status") } + filter: { status: this.status } }); } }); diff --git a/app/assets/javascripts/discourse.js.es6 b/app/assets/javascripts/discourse.js.es6 index 5bce67cd0d4..3c072dfc869 100644 --- a/app/assets/javascripts/discourse.js.es6 +++ b/app/assets/javascripts/discourse.js.es6 @@ -50,7 +50,7 @@ const Discourse = Ember.Application.extend(FocusEvent, { @observes("_docTitle", "hasFocus", "contextCount", "notificationCount") _titleChanged() { - let title = this.get("_docTitle") || Discourse.SiteSettings.title; + let title = this._docTitle || Discourse.SiteSettings.title; // if we change this we can trigger changes on document.title // only set if changed. @@ -58,7 +58,7 @@ const Discourse = Ember.Application.extend(FocusEvent, { $("title").text(title); } - var displayCount = this.get("displayCount"); + var displayCount = this.displayCount; if (displayCount > 0 && !Discourse.User.currentProp("dynamic_favicon")) { title = `(${displayCount}) ${title}`; } @@ -70,8 +70,8 @@ const Discourse = Ember.Application.extend(FocusEvent, { displayCount() { return Discourse.User.current() && Discourse.User.currentProp("title_count_mode") === "notifications" - ? this.get("notificationCount") - : this.get("contextCount"); + ? this.notificationCount + : this.contextCount; }, @observes("contextCount", "notificationCount") @@ -86,7 +86,7 @@ const Discourse = Ember.Application.extend(FocusEvent, { url = Discourse.getURL("/favicon/proxied?" + encodeURIComponent(url)); } - var displayCount = this.get("displayCount"); + var displayCount = this.displayCount; new window.Favcount(url).set(displayCount); } @@ -105,26 +105,26 @@ const Discourse = Ember.Application.extend(FocusEvent, { }, updateNotificationCount(count) { - if (!this.get("hasFocus")) { + if (!this.hasFocus) { this.set("notificationCount", count); } }, incrementBackgroundContextCount() { - if (!this.get("hasFocus")) { + if (!this.hasFocus) { this.set("backgroundNotify", true); - this.set("contextCount", (this.get("contextCount") || 0) + 1); + this.set("contextCount", (this.contextCount || 0) + 1); } }, @observes("hasFocus") resetCounts() { - if (this.get("hasFocus") && this.get("backgroundNotify")) { + if (this.hasFocus && this.backgroundNotify) { this.set("contextCount", 0); } this.set("backgroundNotify", false); - if (this.get("hasFocus")) { + if (this.hasFocus) { this.set("notificationCount", 0); } }, @@ -198,17 +198,17 @@ const Discourse = Ember.Application.extend(FocusEvent, { assetVersion: Ember.computed({ get() { - return this.get("currentAssetVersion"); + return this.currentAssetVersion; }, set(key, val) { if (val) { - if (this.get("currentAssetVersion")) { + if (this.currentAssetVersion) { this.set("desiredAssetVersion", val); } else { this.set("currentAssetVersion", val); } } - return this.get("currentAssetVersion"); + return this.currentAssetVersion; } }) }).create(); diff --git a/app/assets/javascripts/discourse/components/add-category-tag-classes.js.es6 b/app/assets/javascripts/discourse/components/add-category-tag-classes.js.es6 index 2339835f482..d5399dcfe76 100644 --- a/app/assets/javascripts/discourse/components/add-category-tag-classes.js.es6 +++ b/app/assets/javascripts/discourse/components/add-category-tag-classes.js.es6 @@ -13,7 +13,7 @@ export default Ember.Component.extend({ return; } const slug = this.get("category.fullSlug"); - const tags = this.get("tags"); + const tags = this.tags; this._removeClass(); diff --git a/app/assets/javascripts/discourse/components/auth-token-dropdown.es6 b/app/assets/javascripts/discourse/components/auth-token-dropdown.es6 index 8b3630b7dc5..8187c6fde1c 100644 --- a/app/assets/javascripts/discourse/components/auth-token-dropdown.es6 +++ b/app/assets/javascripts/discourse/components/auth-token-dropdown.es6 @@ -29,10 +29,10 @@ export default DropdownSelectBoxComponent.extend({ onSelect(id) { switch (id) { case "notYou": - this.showToken(this.get("token")); + this.showToken(this.token); break; case "logOut": - this.revokeAuthToken(this.get("token")); + this.revokeAuthToken(this.token); break; } } diff --git a/app/assets/javascripts/discourse/components/avatar-flair.js.es6 b/app/assets/javascripts/discourse/components/avatar-flair.js.es6 index 39cc80050c9..4d0bd2e131e 100644 --- a/app/assets/javascripts/discourse/components/avatar-flair.js.es6 +++ b/app/assets/javascripts/discourse/components/avatar-flair.js.es6 @@ -11,10 +11,10 @@ export default MountWidget.extend({ buildArgs() { return { - primary_group_flair_url: this.get("flairURL"), - primary_group_flair_bg_color: this.get("flairBgColor"), - primary_group_flair_color: this.get("flairColor"), - primary_group_name: this.get("groupName") + primary_group_flair_url: this.flairURL, + primary_group_flair_bg_color: this.flairBgColor, + primary_group_flair_color: this.flairColor, + primary_group_name: this.groupName }; } }); diff --git a/app/assets/javascripts/discourse/components/backup-codes.js.es6 b/app/assets/javascripts/discourse/components/backup-codes.js.es6 index 016040e4bb7..08d33416f4b 100644 --- a/app/assets/javascripts/discourse/components/backup-codes.js.es6 +++ b/app/assets/javascripts/discourse/components/backup-codes.js.es6 @@ -44,13 +44,13 @@ export default Ember.Component.extend({ actions: { copyToClipboard() { this._selectAllBackupCodes(); - this.get("copyBackupCode")(document.execCommand("copy")); + this.copyBackupCode(document.execCommand("copy")); } }, _selectAllBackupCodes() { const $textArea = this.$("#backupCodes"); $textArea[0].focus(); - $textArea[0].setSelectionRange(0, this.get("formattedBackupCodes").length); + $textArea[0].setSelectionRange(0, this.formattedBackupCodes.length); } }); diff --git a/app/assets/javascripts/discourse/components/badge-selector.js.es6 b/app/assets/javascripts/discourse/components/badge-selector.js.es6 index 99285b6ea2a..06eb22f5fdf 100644 --- a/app/assets/javascripts/discourse/components/badge-selector.js.es6 +++ b/app/assets/javascripts/discourse/components/badge-selector.js.es6 @@ -13,7 +13,7 @@ export default Ember.Component.extend({ @observes("badgeNames") _update() { - if (this.get("canReceiveUpdates") === "true") + if (this.canReceiveUpdates === "true") this._initializeAutocomplete({ updateData: true }); }, @@ -24,10 +24,10 @@ export default Ember.Component.extend({ self.$("input").autocomplete({ allowAny: false, - items: _.isArray(this.get("badgeNames")) - ? this.get("badgeNames") - : [this.get("badgeNames")], - single: this.get("single"), + items: _.isArray(this.badgeNames) + ? this.badgeNames + : [this.badgeNames], + single: this.single, updateData: opts && opts.updateData ? opts.updateData : false, onChangeItems: function(items) { selectedBadges = items; diff --git a/app/assets/javascripts/discourse/components/badge-title.js.es6 b/app/assets/javascripts/discourse/components/badge-title.js.es6 index 6c3cc376333..ff200793800 100644 --- a/app/assets/javascripts/discourse/components/badge-title.js.es6 +++ b/app/assets/javascripts/discourse/components/badge-title.js.es6 @@ -11,7 +11,7 @@ export default Ember.Component.extend(BadgeSelectController, { save() { this.setProperties({ saved: false, saving: true }); - const badge_id = this.get("selectedUserBadgeId") || 0; + const badge_id = this.selectedUserBadgeId || 0; ajax(this.get("user.path") + "/preferences/badge_title", { type: "PUT", diff --git a/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 b/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 index 651dac43278..e08bf9d5892 100644 --- a/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 +++ b/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 @@ -6,7 +6,7 @@ export default Ember.Component.extend({ @computed("topicList.loaded") loaded() { - var topicList = this.get("topicList"); + var topicList = this.topicList; if (topicList) { return topicList.get("loaded"); } else { @@ -15,7 +15,7 @@ export default Ember.Component.extend({ }, _topicListChanged: function() { - this._initFromTopicList(this.get("topicList")); + this._initFromTopicList(this.topicList); }.observes("topicList.[]"), _initFromTopicList(topicList) { @@ -27,7 +27,7 @@ export default Ember.Component.extend({ init() { this._super(...arguments); - const topicList = this.get("topicList"); + const topicList = this.topicList; if (topicList) { this._initFromTopicList(topicList); } @@ -58,7 +58,7 @@ export default Ember.Component.extend({ } } - const topic = this.get("topics").findBy("id", parseInt(topicId)); + const topic = this.topics.findBy("id", parseInt(topicId)); this.appEvents.trigger("topic-entrance:show", { topic, position: target.offset() diff --git a/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 b/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 index 3ef5c99af72..cd8157c8286 100644 --- a/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 +++ b/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 @@ -51,7 +51,7 @@ export default Ember.Component.extend({ return []; } - return this.get("categories").filter( + return this.categories.filter( c => c.get("parentCategory") === firstCategory ); } diff --git a/app/assets/javascripts/discourse/components/bulk-select-button.js.es6 b/app/assets/javascripts/discourse/components/bulk-select-button.js.es6 index 46a5731b85a..04d125b8035 100644 --- a/app/assets/javascripts/discourse/components/bulk-select-button.js.es6 +++ b/app/assets/javascripts/discourse/components/bulk-select-button.js.es6 @@ -7,13 +7,13 @@ export default Ember.Component.extend({ showBulkActions() { const controller = showModal("topic-bulk-actions", { model: { - topics: this.get("selected"), - category: this.get("category") + topics: this.selected, + category: this.category }, title: "topics.bulk.actions" }); - const action = this.get("action"); + const action = this.action; if (action) { controller.set("refreshClosure", () => action()); } diff --git a/app/assets/javascripts/discourse/components/categories-boxes-with-topics.js.es6 b/app/assets/javascripts/discourse/components/categories-boxes-with-topics.js.es6 index bf558ed48e9..ed9e4a87a79 100644 --- a/app/assets/javascripts/discourse/components/categories-boxes-with-topics.js.es6 +++ b/app/assets/javascripts/discourse/components/categories-boxes-with-topics.js.es6 @@ -9,7 +9,7 @@ export default Ember.Component.extend({ @computed("categories.[].uploaded_logo.url") anyLogos() { - return this.get("categories").any(c => { + return this.categories.any(c => { return !Ember.isEmpty(c.get("uploaded_logo.url")); }); } diff --git a/app/assets/javascripts/discourse/components/categories-boxes.js.es6 b/app/assets/javascripts/discourse/components/categories-boxes.js.es6 index 56f127ddd95..bc35ab4b142 100644 --- a/app/assets/javascripts/discourse/components/categories-boxes.js.es6 +++ b/app/assets/javascripts/discourse/components/categories-boxes.js.es6 @@ -11,14 +11,14 @@ export default Ember.Component.extend({ @computed("categories.[].uploaded_logo.url") anyLogos() { - return this.get("categories").any( + return this.categories.any( c => !Ember.isEmpty(c.get("uploaded_logo.url")) ); }, @computed("categories.[].subcategories") hasSubcategories() { - return this.get("categories").any( + return this.categories.any( c => !Ember.isEmpty(c.get("subcategories")) ); }, diff --git a/app/assets/javascripts/discourse/components/choose-message.js.es6 b/app/assets/javascripts/discourse/components/choose-message.js.es6 index 3bbbf83f099..581cc361d58 100644 --- a/app/assets/javascripts/discourse/components/choose-message.js.es6 +++ b/app/assets/javascripts/discourse/components/choose-message.js.es6 @@ -14,12 +14,12 @@ export default Ember.Component.extend({ noResults: true, selectedTopicId: null }); - this.search(this.get("messageTitle")); + this.search(this.messageTitle); }, @observes("messages") messagesChanged() { - const messages = this.get("messages"); + const messages = this.messages; if (messages) { this.set("noResults", messages.length === 0); } @@ -27,7 +27,7 @@ export default Ember.Component.extend({ }, search: debounce(function(title) { - const currentTopicId = this.get("currentTopicId"); + const currentTopicId = this.currentTopicId; if (Ember.isEmpty(title)) { this.setProperties({ messages: null, loading: false }); diff --git a/app/assets/javascripts/discourse/components/choose-topic.js.es6 b/app/assets/javascripts/discourse/components/choose-topic.js.es6 index 3d787d58431..d612b0fc7b5 100644 --- a/app/assets/javascripts/discourse/components/choose-topic.js.es6 +++ b/app/assets/javascripts/discourse/components/choose-topic.js.es6 @@ -12,11 +12,11 @@ export default Ember.Component.extend({ noResults: true, selectedTopicId: null }); - this.search(this.get("topicTitle")); + this.search(this.topicTitle); }.observes("topicTitle"), topicsChanged: function() { - const topics = this.get("topics"); + const topics = this.topics; if (topics) { this.set("noResults", topics.length === 0); } @@ -25,7 +25,7 @@ export default Ember.Component.extend({ search: debounce(function(title) { const self = this, - currentTopicId = this.get("currentTopicId"); + currentTopicId = this.currentTopicId; if (Ember.isEmpty(title)) { self.setProperties({ topics: null, loading: false }); diff --git a/app/assets/javascripts/discourse/components/color-picker-choice.js.es6 b/app/assets/javascripts/discourse/components/color-picker-choice.js.es6 index 01bac55369b..8ea284b8f3b 100644 --- a/app/assets/javascripts/discourse/components/color-picker-choice.js.es6 +++ b/app/assets/javascripts/discourse/components/color-picker-choice.js.es6 @@ -22,6 +22,6 @@ export default Ember.Component.extend({ click(e) { e.preventDefault(); - this.selectColor(this.get("color")); + this.selectColor(this.color); } }); diff --git a/app/assets/javascripts/discourse/components/composer-body.js.es6 b/app/assets/javascripts/discourse/components/composer-body.js.es6 index 683c3a7ad47..a266d6fc0a5 100644 --- a/app/assets/javascripts/discourse/components/composer-body.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-body.js.es6 @@ -88,7 +88,7 @@ export default Ember.Component.extend(KeyEnterEscape, { @observes("composeState") disableFullscreen() { if ( - this.get("composeState") !== Composer.OPEN && + this.composeState !== Composer.OPEN && positioningWorkaround.blur ) { positioningWorkaround.blur(); diff --git a/app/assets/javascripts/discourse/components/composer-editor.js.es6 b/app/assets/javascripts/discourse/components/composer-editor.js.es6 index 286edfcb3e3..91d30b2d828 100644 --- a/app/assets/javascripts/discourse/components/composer-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-editor.js.es6 @@ -111,7 +111,7 @@ export default Ember.Component.extend({ @observes("focusTarget") setFocus() { - if (this.get("focusTarget") === "editor") { + if (this.focusTarget === "editor") { this.$("textarea").putCursorAtEnd(); } }, @@ -124,7 +124,7 @@ export default Ember.Component.extend({ formatUsername, lookupAvatarByPostNumber: (postNumber, topicId) => { - const topic = this.get("topic"); + const topic = this.topic; if (!topic) { return; } @@ -139,7 +139,7 @@ export default Ember.Component.extend({ }, lookupPrimaryUserGroupByPostNumber: (postNumber, topicId) => { - const topic = this.get("topic"); + const topic = this.topic; if (!topic) { return; } @@ -336,7 +336,7 @@ export default Ember.Component.extend({ }, _syncScroll($callback, $input, $preview) { - if (!this.get("scrollMap") || this.get("shouldBuildScrollMap")) { + if (!this.scrollMap || this.shouldBuildScrollMap) { this.set("scrollMap", this._buildScrollMap($input, $preview)); this.set("shouldBuildScrollMap", false); } @@ -346,7 +346,7 @@ export default Ember.Component.extend({ $callback, $input, $preview, - this.get("scrollMap"), + this.scrollMap, 20 ); }, @@ -565,7 +565,7 @@ export default Ember.Component.extend({ _warnMentionedGroups($preview) { Ember.run.scheduleOnce("afterRender", () => { - var found = this.get("warnedGroupMentions") || []; + var found = this.warnedGroupMentions || []; $preview.find(".mention-group.notify").each((idx, e) => { const $e = $(e); var name = $e.data("name"); @@ -598,7 +598,7 @@ export default Ember.Component.extend({ } Ember.run.scheduleOnce("afterRender", () => { - let found = this.get("warnedCannotSeeMentions") || []; + let found = this.warnedCannotSeeMentions || []; $preview.find(".mention.cannot-see").each((idx, e) => { const $e = $(e); @@ -642,7 +642,7 @@ export default Ember.Component.extend({ if (removePlaceholder) { this.appEvents.trigger( "composer:replace-text", - this.get("uploadPlaceholder"), + this.uploadPlaceholder, "" ); } @@ -741,7 +741,7 @@ export default Ember.Component.extend({ this.appEvents.trigger( "composer:insert-text", - this.get("uploadPlaceholder") + this.uploadPlaceholder ); if (data.xhr && data.originalFiles.length === 1) { @@ -758,7 +758,7 @@ export default Ember.Component.extend({ cacheShortUploadUrl(upload.short_url, upload.url); this.appEvents.trigger( "composer:replace-text", - this.get("uploadPlaceholder").trim(), + this.uploadPlaceholder.trim(), markdown ); this._resetUpload(false); @@ -958,22 +958,22 @@ export default Ember.Component.extend({ id: "quote", group: "fontStyles", icon: "far-comment", - sendAction: this.get("importQuote"), + sendAction: this.importQuote, title: "composer.quote_post_title", unshift: true }); if ( - this.get("allowUpload") && - this.get("uploadIcon") && + this.allowUpload && + this.uploadIcon && !this.site.mobileView ) { toolbar.addButton({ id: "upload", group: "insertions", - icon: this.get("uploadIcon"), + icon: this.uploadIcon, title: "upload", - sendAction: this.get("showUploadModal") + sendAction: this.showUploadModal }); } diff --git a/app/assets/javascripts/discourse/components/composer-message.js.es6 b/app/assets/javascripts/discourse/components/composer-message.js.es6 index 0805e28434a..dc8d387a1e3 100644 --- a/app/assets/javascripts/discourse/components/composer-message.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-message.js.es6 @@ -16,7 +16,7 @@ export default Ember.Component.extend({ actions: { closeMessage() { - this.closeMessage(this.get("message")); + this.closeMessage(this.message); } } }); diff --git a/app/assets/javascripts/discourse/components/composer-messages.js.es6 b/app/assets/javascripts/discourse/components/composer-messages.js.es6 index 3bb195d897b..6a01d339502 100644 --- a/app/assets/javascripts/discourse/components/composer-messages.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-messages.js.es6 @@ -34,13 +34,13 @@ export default Ember.Component.extend({ }, _closeTop() { - const messages = this.get("messages"); + const messages = this.messages; messages.popObject(); this.set("messageCount", messages.get("length")); }, _removeMessage(message) { - const messages = this.get("messages"); + const messages = this.messages; messages.removeObject(message); this.set("messageCount", messages.get("length")); }, @@ -53,15 +53,15 @@ export default Ember.Component.extend({ hideMessage(message) { this._removeMessage(message); // kind of hacky but the visibility depends on this - this.get("messagesByTemplate")[message.get("templateName")] = undefined; + this.messagesByTemplate[message.get("templateName")] = undefined; }, popup(message) { - const messagesByTemplate = this.get("messagesByTemplate"); + const messagesByTemplate = this.messagesByTemplate; const templateName = message.get("templateName"); if (!messagesByTemplate[templateName]) { - const messages = this.get("messages"); + const messages = this.messages; messages.pushObject(message); this.set("messageCount", messages.get("length")); messagesByTemplate[templateName] = message; @@ -91,7 +91,7 @@ export default Ember.Component.extend({ return; } - const composer = this.get("composer"); + const composer = this.composer; if (composer.get("privateMessage")) { let usernames = composer.get("targetUsernames"); @@ -116,7 +116,7 @@ export default Ember.Component.extend({ } } - this.get("queuedForTyping").forEach(msg => this.send("popup", msg)); + this.queuedForTyping.forEach(msg => this.send("popup", msg)); }, _create(info) { @@ -125,7 +125,7 @@ export default Ember.Component.extend({ }, _findSimilar() { - const composer = this.get("composer"); + const composer = this.composer; // We don't care about similar topics unless creating a topic if (!composer.get("creatingTopic")) { @@ -148,7 +148,7 @@ export default Ember.Component.extend({ } this._lastSimilaritySearch = concat; - const similarTopics = this.get("similarTopics"); + const similarTopics = this.similarTopics; const message = this._similarTopicsMessage || composer.store.createRecord("composer-message", { @@ -174,11 +174,11 @@ export default Ember.Component.extend({ // Figure out if there are any messages that should be displayed above the composer. _findMessages() { - if (this.get("checkedMessages")) { + if (this.checkedMessages) { return; } - const composer = this.get("composer"); + const composer = this.composer; const args = { composer_action: composer.get("action") }; const topicId = composer.get("topic.id"); const postId = composer.get("post.id"); @@ -204,7 +204,7 @@ export default Ember.Component.extend({ } this.set("checkedMessages", true); - const queuedForTyping = this.get("queuedForTyping"); + const queuedForTyping = this.queuedForTyping; messages.forEach(msg => msg.wait_for_typing ? queuedForTyping.addObject(msg) diff --git a/app/assets/javascripts/discourse/components/composer-title.js.es6 b/app/assets/javascripts/discourse/components/composer-title.js.es6 index 71149e180b5..3c196f709db 100644 --- a/app/assets/javascripts/discourse/components/composer-title.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-title.js.es6 @@ -13,7 +13,7 @@ export default Ember.Component.extend({ didInsertElement() { this._super(...arguments); - if (this.get("focusTarget") === "title") { + if (this.focusTarget === "title") { const $input = this.$("input"); afterTransition(this.$().closest("#reply-control"), () => { @@ -64,7 +64,7 @@ export default Ember.Component.extend({ titleMaxLength() { // maxLength gets in the way of pasting long links, so don't use it if featured links are allowed. // Validation will display a message if titles are too long. - return this.get("watchForLink") + return this.watchForLink ? null : this.siteSettings.max_topic_title_length; }, @@ -74,7 +74,7 @@ export default Ember.Component.extend({ if (this.get("composer.titleLength") === 0) { this.set("autoPosted", false); } - if (this.get("autoPosted") || !this.get("watchForLink")) { + if (this.autoPosted || !this.watchForLink) { return; } @@ -91,7 +91,7 @@ export default Ember.Component.extend({ @observes("composer.replyLength") _clearFeaturedLink() { - if (this.get("watchForLink") && this.bodyIsDefault()) { + if (this.watchForLink && this.bodyIsDefault()) { this.set("composer.featuredLink", null); } }, @@ -101,7 +101,7 @@ export default Ember.Component.extend({ return; } - if (this.get("isAbsoluteUrl") && this.bodyIsDefault()) { + if (this.isAbsoluteUrl && this.bodyIsDefault()) { // only feature links to external sites if ( this.get("composer.title").match( @@ -155,7 +155,7 @@ export default Ember.Component.extend({ const $h = $(html), heading = $h.find("h3").length > 0 ? $h.find("h3") : $h.find("h4"), - composer = this.get("composer"); + composer = this.composer; composer.appendText(this.get("composer.title"), null, { block: true }); diff --git a/app/assets/javascripts/discourse/components/composer-user-selector.js.es6 b/app/assets/javascripts/discourse/components/composer-user-selector.js.es6 index 747663166be..77c7537ecef 100644 --- a/app/assets/javascripts/discourse/components/composer-user-selector.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-user-selector.js.es6 @@ -11,7 +11,7 @@ export default Ember.Component.extend({ didInsertElement() { this._super(...arguments); - if (this.get("focusTarget") === "usernames") { + if (this.focusTarget === "usernames") { this.$("input").putCursorAtEnd(); } }, @@ -46,7 +46,7 @@ export default Ember.Component.extend({ const selector = "#reply-control #reply-title, #reply-control .d-editor-input"; - if (this.get("shouldHide")) { + if (this.shouldHide) { $(selector).on("focus.composer-user-selector", () => { this.set("showSelector", false); this.appEvents.trigger("composer:resize"); diff --git a/app/assets/javascripts/discourse/components/cook-text.js.es6 b/app/assets/javascripts/discourse/components/cook-text.js.es6 index 2799b736ec1..9fefced7492 100644 --- a/app/assets/javascripts/discourse/components/cook-text.js.es6 +++ b/app/assets/javascripts/discourse/components/cook-text.js.es6 @@ -7,7 +7,7 @@ const CookText = Ember.Component.extend({ didReceiveAttrs() { this._super(...arguments); - cookAsync(this.get("rawText")).then(cooked => { + cookAsync(this.rawText).then(cooked => { this.set("cooked", cooked); // no choice but to defer this cause // pretty text may only be loaded now diff --git a/app/assets/javascripts/discourse/components/count-i18n.js.es6 b/app/assets/javascripts/discourse/components/count-i18n.js.es6 index b41376b87ed..5ee48fb5ab1 100644 --- a/app/assets/javascripts/discourse/components/count-i18n.js.es6 +++ b/app/assets/javascripts/discourse/components/count-i18n.js.es6 @@ -7,8 +7,8 @@ export default Ember.Component.extend( buildBuffer(buffer) { buffer.push( - I18n.t(this.get("key") + (this.get("suffix") || ""), { - count: this.get("count") + I18n.t(this.key + (this.suffix || ""), { + count: this.count }) ); } diff --git a/app/assets/javascripts/discourse/components/create-account.js.es6 b/app/assets/javascripts/discourse/components/create-account.js.es6 index e13fd4ca1d2..74f08fbb9b8 100644 --- a/app/assets/javascripts/discourse/components/create-account.js.es6 +++ b/app/assets/javascripts/discourse/components/create-account.js.es6 @@ -9,7 +9,7 @@ export default Ember.Component.extend({ } this.$().on("keydown.discourse-create-account", e => { - if (!this.get("disabled") && e.keyCode === 13) { + if (!this.disabled && e.keyCode === 13) { e.preventDefault(); e.stopPropagation(); this.action(); diff --git a/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 b/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 index 47f73a02afa..404949510fc 100644 --- a/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 +++ b/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 @@ -15,7 +15,7 @@ export default Ember.Component.extend({ init() { this._super(...arguments); - if (this.get("shouldSee")) { + if (this.shouldSee) { let topicCount = 0, postCount = 0; @@ -28,8 +28,8 @@ export default Ember.Component.extend({ }); if ( - topicCount < this.get("requiredTopics") || - postCount < this.get("requiredPosts") + topicCount < this.requiredTopics || + postCount < this.requiredPosts ) { this.set("enabled", true); this.fetchLiveStats(); @@ -51,10 +51,10 @@ export default Ember.Component.extend({ @computed("enabled", "shouldSee", "publicTopicCount", "publicPostCount") hidden() { return ( - !this.get("enabled") || - !this.get("shouldSee") || - this.get("publicTopicCount") == null || - this.get("publicPostCount") == null + !this.enabled || + !this.shouldSee || + this.publicTopicCount == null || + this.publicPostCount == null ); }, @@ -67,11 +67,11 @@ export default Ember.Component.extend({ var msg = null; if ( - this.get("publicTopicCount") < this.get("requiredTopics") && - this.get("publicPostCount") < this.get("requiredPosts") + this.publicTopicCount < this.requiredTopics && + this.publicPostCount < this.requiredPosts ) { msg = "too_few_topics_and_posts_notice"; - } else if (this.get("publicTopicCount") < this.get("requiredTopics")) { + } else if (this.publicTopicCount < this.requiredTopics) { msg = "too_few_topics_notice"; } else { msg = "too_few_posts_notice"; @@ -79,17 +79,17 @@ export default Ember.Component.extend({ return new Handlebars.SafeString( I18n.t(msg, { - requiredTopics: this.get("requiredTopics"), - requiredPosts: this.get("requiredPosts"), - currentTopics: this.get("publicTopicCount"), - currentPosts: this.get("publicPostCount") + requiredTopics: this.requiredTopics, + requiredPosts: this.requiredPosts, + currentTopics: this.publicTopicCount, + currentPosts: this.publicPostCount }) ); }, @observes("topicTrackingState.incomingCount") fetchLiveStats() { - if (!this.get("enabled")) { + if (!this.enabled) { return; } @@ -98,8 +98,8 @@ export default Ember.Component.extend({ this.set("publicTopicCount", stats.get("public_topic_count")); this.set("publicPostCount", stats.get("public_post_count")); if ( - this.get("publicTopicCount") >= this.get("requiredTopics") && - this.get("publicPostCount") >= this.get("requiredPosts") + this.publicTopicCount >= this.requiredTopics && + this.publicPostCount >= this.requiredPosts ) { this.set("enabled", false); // No more checks } diff --git a/app/assets/javascripts/discourse/components/custom-html.js.es6 b/app/assets/javascripts/discourse/components/custom-html.js.es6 index 6bb64ec5f23..b30649deb58 100644 --- a/app/assets/javascripts/discourse/components/custom-html.js.es6 +++ b/app/assets/javascripts/discourse/components/custom-html.js.es6 @@ -6,7 +6,7 @@ export default Ember.Component.extend({ init() { this._super(...arguments); - const name = this.get("name"); + const name = this.name; const html = getCustomHTML(name); if (html) { @@ -22,15 +22,15 @@ export default Ember.Component.extend({ didInsertElement() { this._super(...arguments); - if (this.get("triggerAppEvent") === "true") { - this.appEvents.trigger(`inserted-custom-html:${this.get("name")}`); + if (this.triggerAppEvent === "true") { + this.appEvents.trigger(`inserted-custom-html:${this.name}`); } }, willDestroyElement() { this._super(...arguments); - if (this.get("triggerAppEvent") === "true") { - this.appEvents.trigger(`destroyed-custom-html:${this.get("name")}`); + if (this.triggerAppEvent === "true") { + this.appEvents.trigger(`destroyed-custom-html:${this.name}`); } } }); diff --git a/app/assets/javascripts/discourse/components/d-button.js.es6 b/app/assets/javascripts/discourse/components/d-button.js.es6 index 97e1d3cfac1..3adebce86f3 100644 --- a/app/assets/javascripts/discourse/components/d-button.js.es6 +++ b/app/assets/javascripts/discourse/components/d-button.js.es6 @@ -53,15 +53,15 @@ export default Ember.Component.extend({ }, click() { - if (typeof this.get("action") === "string") { - this.sendAction("action", this.get("actionParam")); + if (typeof this.action === "string") { + this.sendAction("action", this.actionParam); } else if ( - typeof this.get("action") === "object" && - this.get("action").value + typeof this.action === "object" && + this.action.value ) { - this.get("action").value(this.get("actionParam")); - } else if (typeof this.get("action") === "function") { - this.get("action")(this.get("actionParam")); + this.action.value(this.actionParam); + } else if (typeof this.action === "function") { + this.action(this.actionParam); } return false; diff --git a/app/assets/javascripts/discourse/components/d-editor-modal.js.es6 b/app/assets/javascripts/discourse/components/d-editor-modal.js.es6 index 885d5c17060..6456bdc7d58 100644 --- a/app/assets/javascripts/discourse/components/d-editor-modal.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor-modal.js.es6 @@ -5,7 +5,7 @@ export default Ember.Component.extend({ @observes("hidden") _hiddenChanged() { - if (!this.get("hidden")) { + if (!this.hidden) { Ember.run.scheduleOnce("afterRender", () => { const $modal = this.$(); const $parent = this.$().closest(".d-editor"); @@ -28,7 +28,7 @@ export default Ember.Component.extend({ @on("didInsertElement") _listenKeys() { this.$().on("keydown.d-modal", key => { - if (this.get("hidden")) { + if (this.hidden) { return; } diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index 1a1450a4c23..196942edcea 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -234,7 +234,7 @@ export default Ember.Component.extend({ _readyNow() { this.set("ready", true); - if (this.get("autofocus")) { + if (this.autofocus) { this.$("textarea").focus(); } }, @@ -289,7 +289,7 @@ export default Ember.Component.extend({ } }); - if (this.get("composerEvents")) { + if (this.composerEvents) { this.appEvents.on("composer:insert-block", this, "_insertBlock"); this.appEvents.on("composer:insert-text", this, "_insertText"); this.appEvents.on("composer:replace-text", this, "_replaceText"); @@ -307,7 +307,7 @@ export default Ember.Component.extend({ @on("willDestroyElement") _shutDown() { - if (this.get("composerEvents")) { + if (this.composerEvents) { this.appEvents.off("composer:insert-block", this, "_insertBlock"); this.appEvents.off("composer:insert-text", this, "_insertText"); this.appEvents.off("composer:replace-text", this, "_replaceText"); @@ -340,11 +340,11 @@ export default Ember.Component.extend({ return; } - const value = this.get("value"); - const markdownOptions = this.get("markdownOptions") || {}; + const value = this.value; + const markdownOptions = this.markdownOptions || {}; cookAsync(value, markdownOptions).then(cooked => { - if (this.get("isDestroyed")) { + if (this.isDestroyed) { return; } this.set("preview", cooked); @@ -364,7 +364,7 @@ export default Ember.Component.extend({ @observes("ready", "value") _watchForChanges() { - if (!this.get("ready")) { + if (!this.ready) { return; } @@ -500,7 +500,7 @@ export default Ember.Component.extend({ }, _getSelected(trimLeading, opts) { - if (!this.get("ready")) { + if (!this.ready) { return; } @@ -676,7 +676,7 @@ export default Ember.Component.extend({ }, _replaceText(oldVal, newVal, opts = {}) { - const val = this.get("value"); + const val = this.value; const needleStart = val.indexOf(oldVal); if (needleStart === -1) { @@ -873,12 +873,12 @@ export default Ember.Component.extend({ actions: { emoji() { - if (this.get("disabled")) { + if (this.disabled) { return; } this.set("isEditorFocused", $("textarea.d-editor-input").is(":focus")); - this.set("emojiPickerIsActive", !this.get("emojiPickerIsActive")); + this.set("emojiPickerIsActive", !this.emojiPickerIsActive); }, emojiSelected(code) { @@ -900,7 +900,7 @@ export default Ember.Component.extend({ }, toolbarButton(button) { - if (this.get("disabled")) { + if (this.disabled) { return; } @@ -914,7 +914,7 @@ export default Ember.Component.extend({ this._applyList(selected, head, exampleKey, opts), addText: text => this._addText(selected, text), replaceText: text => this._addText({ pre: "", post: "" }, text), - getText: () => this.get("value"), + getText: () => this.value, toggleDirection: () => this._toggleDirection() }; @@ -926,7 +926,7 @@ export default Ember.Component.extend({ }, showLinkModal() { - if (this.get("disabled")) { + if (this.disabled) { return; } @@ -943,7 +943,7 @@ export default Ember.Component.extend({ }, formatCode() { - if (this.get("disabled")) { + if (this.disabled) { return; } @@ -986,7 +986,7 @@ export default Ember.Component.extend({ }, insertLink() { - const origLink = this.get("linkUrl"); + const origLink = this.linkUrl; const linkUrl = origLink.indexOf("://") === -1 ? `http://${origLink}` : origLink; const sel = this._lastSel; @@ -995,7 +995,7 @@ export default Ember.Component.extend({ return; } - const linkText = this.get("linkText") || ""; + const linkText = this.linkText || ""; if (linkText.length) { this._addText(sel, `[${linkText}](${linkUrl})`); } else { diff --git a/app/assets/javascripts/discourse/components/d-modal-body.js.es6 b/app/assets/javascripts/discourse/components/d-modal-body.js.es6 index f9086827e99..f9f46e6167f 100644 --- a/app/assets/javascripts/discourse/components/d-modal-body.js.es6 +++ b/app/assets/javascripts/discourse/components/d-modal-body.js.es6 @@ -26,11 +26,11 @@ export default Ember.Component.extend({ }, _afterFirstRender() { - if (!this.site.mobileView && this.get("autoFocus") !== "false") { + if (!this.site.mobileView && this.autoFocus !== "false") { this.$("input:first").focus(); } - const maxHeight = this.get("maxHeight"); + const maxHeight = this.maxHeight; if (maxHeight) { const maxHeightFloat = parseFloat(maxHeight) / 100.0; if (maxHeightFloat > 0) { diff --git a/app/assets/javascripts/discourse/components/d-modal.js.es6 b/app/assets/javascripts/discourse/components/d-modal.js.es6 index 32a9963652a..4f1d879ddb4 100644 --- a/app/assets/javascripts/discourse/components/d-modal.js.es6 +++ b/app/assets/javascripts/discourse/components/d-modal.js.es6 @@ -18,7 +18,7 @@ export default Ember.Component.extend({ // If we need to render a second modal for any reason, we can't // use `elementId` - if (this.get("modalStyle") !== "inline-modal") { + if (this.modalStyle !== "inline-modal") { this.set("elementId", "discourse-modal"); this.set("modalStyle", "fixed-modal"); } @@ -30,7 +30,7 @@ export default Ember.Component.extend({ @on("didInsertElement") setUp() { $("html").on("keydown.discourse-modal", e => { - if (e.which === 27 && this.get("dismissable")) { + if (e.which === 27 && this.dismissable) { Ember.run.next(() => $(".modal-header a.close").click()); } }); @@ -74,7 +74,7 @@ export default Ember.Component.extend({ }, mouseDown(e) { - if (!this.get("dismissable")) { + if (!this.dismissable) { return; } const $target = $(e.target); diff --git a/app/assets/javascripts/discourse/components/d-section.js.es6 b/app/assets/javascripts/discourse/components/d-section.js.es6 index 4048837e21c..1f1d07a676a 100644 --- a/app/assets/javascripts/discourse/components/d-section.js.es6 +++ b/app/assets/javascripts/discourse/components/d-section.js.es6 @@ -7,17 +7,17 @@ export default Ember.Component.extend({ didInsertElement() { this._super(...arguments); - const pageClass = this.get("pageClass"); + const pageClass = this.pageClass; if (pageClass) { $("body").addClass(`${pageClass}-page`); } - const bodyClass = this.get("bodyClass"); + const bodyClass = this.bodyClass; if (bodyClass) { $("body").addClass(bodyClass); } - if (this.get("scrollTop") === "false") { + if (this.scrollTop === "false") { return; } @@ -26,12 +26,12 @@ export default Ember.Component.extend({ willDestroyElement() { this._super(...arguments); - const pageClass = this.get("pageClass"); + const pageClass = this.pageClass; if (pageClass) { $("body").removeClass(`${pageClass}-page`); } - const bodyClass = this.get("bodyClass"); + const bodyClass = this.bodyClass; if (bodyClass) { $("body").removeClass(bodyClass); } diff --git a/app/assets/javascripts/discourse/components/date-picker-future.js.es6 b/app/assets/javascripts/discourse/components/date-picker-future.js.es6 index b69e8dc510f..74ef9afd7c2 100644 --- a/app/assets/javascripts/discourse/components/date-picker-future.js.es6 +++ b/app/assets/javascripts/discourse/components/date-picker-future.js.es6 @@ -6,11 +6,11 @@ export default DatePicker.extend({ _opts() { return { defaultDate: - this.get("defaultDate") || + this.defaultDate || moment() .add(1, "day") .toDate(), - setDefaultDate: !!this.get("defaultDate") + setDefaultDate: !!this.defaultDate }; } }); diff --git a/app/assets/javascripts/discourse/components/date-picker-past.js.es6 b/app/assets/javascripts/discourse/components/date-picker-past.js.es6 index 027798d2eaf..514bdb8f8f4 100644 --- a/app/assets/javascripts/discourse/components/date-picker-past.js.es6 +++ b/app/assets/javascripts/discourse/components/date-picker-past.js.es6 @@ -6,8 +6,8 @@ export default DatePicker.extend({ _opts() { return { defaultDate: - moment(this.get("defaultDate"), "YYYY-MM-DD").toDate() || new Date(), - setDefaultDate: !!this.get("defaultDate"), + moment(this.defaultDate, "YYYY-MM-DD").toDate() || new Date(), + setDefaultDate: !!this.defaultDate, maxDate: new Date() }; } diff --git a/app/assets/javascripts/discourse/components/date-picker.js.es6 b/app/assets/javascripts/discourse/components/date-picker.js.es6 index 35241ae67b0..8350c2dfe0b 100644 --- a/app/assets/javascripts/discourse/components/date-picker.js.es6 +++ b/app/assets/javascripts/discourse/components/date-picker.js.es6 @@ -12,7 +12,7 @@ export default Ember.Component.extend({ @on("didInsertElement") _loadDatePicker() { const input = this.$(".date-picker")[0]; - const container = $("#" + this.get("containerId"))[0]; + const container = $("#" + this.containerId)[0]; loadScript("/javascripts/pikaday.js").then(() => { Ember.run.next(() => { diff --git a/app/assets/javascripts/discourse/components/desktop-notification-config.js.es6 b/app/assets/javascripts/discourse/components/desktop-notification-config.js.es6 index 604c53791fa..612d9d9f89c 100644 --- a/app/assets/javascripts/discourse/components/desktop-notification-config.js.es6 +++ b/app/assets/javascripts/discourse/components/desktop-notification-config.js.es6 @@ -93,11 +93,11 @@ export default Ember.Component.extend({ }, turnoff() { - if (this.get("isEnabledDesktop")) { + if (this.isEnabledDesktop) { this.set("notificationsDisabled", "disabled"); this.notifyPropertyChange("notificationsPermission"); } - if (this.get("isEnabledPush")) { + if (this.isEnabledPush) { unsubscribePushNotification(this.currentUser, () => { this.set("isEnabledPush", ""); }); diff --git a/app/assets/javascripts/discourse/components/directory-toggle.js.es6 b/app/assets/javascripts/discourse/components/directory-toggle.js.es6 index 8bc11d1a374..6765568078f 100644 --- a/app/assets/javascripts/discourse/components/directory-toggle.js.es6 +++ b/app/assets/javascripts/discourse/components/directory-toggle.js.es6 @@ -13,32 +13,32 @@ export default Ember.Component.extend( @computed("field", "labelKey") title(field, labelKey) { if (!labelKey) { - labelKey = `directory.${this.get("field")}`; + labelKey = `directory.${this.field}`; } return I18n.t(labelKey + "_long", { defaultValue: I18n.t(labelKey) }); }, buildBuffer(buffer) { - const icon = this.get("icon"); + const icon = this.icon; if (icon) { buffer.push(iconHTML(icon)); } - const field = this.get("field"); - buffer.push(I18n.t(this.get("labelKey") || `directory.${field}`)); + const field = this.field; + buffer.push(I18n.t(this.labelKey || `directory.${field}`)); - if (field === this.get("order")) { - buffer.push(iconHTML(this.get("asc") ? "chevron-up" : "chevron-down")); + if (field === this.order) { + buffer.push(iconHTML(this.asc ? "chevron-up" : "chevron-down")); } }, click() { - const currentOrder = this.get("order"), - field = this.get("field"); + const currentOrder = this.order, + field = this.field; if (currentOrder === field) { - this.set("asc", this.get("asc") ? null : true); + this.set("asc", this.asc ? null : true); } else { this.setProperties({ order: field, asc: null }); } diff --git a/app/assets/javascripts/discourse/components/discourse-banner.js.es6 b/app/assets/javascripts/discourse/components/discourse-banner.js.es6 index 80997b4c9cb..6a84f538ca1 100644 --- a/app/assets/javascripts/discourse/components/discourse-banner.js.es6 +++ b/app/assets/javascripts/discourse/components/discourse-banner.js.es6 @@ -18,8 +18,8 @@ export default Ember.Component.extend({ actions: { dismiss() { - if (this.get("user")) { - this.get("user").dismissBanner(this.get("banner.key")); + if (this.user) { + this.user.dismissBanner(this.get("banner.key")); } else { this.set("visible", false); this.keyValueStore.set({ diff --git a/app/assets/javascripts/discourse/components/discourse-linked-text.js.es6 b/app/assets/javascripts/discourse/components/discourse-linked-text.js.es6 index 0a45c0bc1ba..17398e4a21d 100644 --- a/app/assets/javascripts/discourse/components/discourse-linked-text.js.es6 +++ b/app/assets/javascripts/discourse/components/discourse-linked-text.js.es6 @@ -10,7 +10,7 @@ export default Ember.Component.extend({ click(event) { if (event.target.tagName.toUpperCase() === "A") { - this.action(this.get("actionParam")); + this.action(this.actionParam); } return false; diff --git a/app/assets/javascripts/discourse/components/discourse-topic.js.es6 b/app/assets/javascripts/discourse/components/discourse-topic.js.es6 index 114f52df908..dc84102a304 100644 --- a/app/assets/javascripts/discourse/components/discourse-topic.js.es6 +++ b/app/assets/javascripts/discourse/components/discourse-topic.js.es6 @@ -46,8 +46,8 @@ export default Ember.Component.extend( // Ember is supposed to only call observers when values change but something // in our view set up is firing this observer with the same value. This check // prevents scrolled from being called twice. - const enteredAt = this.get("enteredAt"); - if (enteredAt && this.get("lastEnteredAt") !== enteredAt) { + const enteredAt = this.enteredAt; + if (enteredAt && this.lastEnteredAt !== enteredAt) { this._lastShowTopic = null; Ember.run.schedule("afterRender", () => this.scrolled()); this.set("lastEnteredAt", enteredAt); @@ -157,7 +157,7 @@ export default Ember.Component.extend( } const offset = window.pageYOffset || $("html").scrollTop(); - if (this.get("dockAt") === 0) { + if (this.dockAt === 0) { const title = $("#topic-title"); if (title && title.length === 1) { this.set("dockAt", title.offset().top); @@ -166,7 +166,7 @@ export default Ember.Component.extend( this.set("hasScrolled", offset > 0); - const topic = this.get("topic"); + const topic = this.topic; const showTopic = this.shouldShowTopicInHeader(topic, offset); if (showTopic !== this._lastShowTopic) { @@ -205,7 +205,7 @@ export default Ember.Component.extend( toggleMobileHeaderTopic() { return this.appEvents.trigger( "header:update-topic", - this.mobileScrollDirection === "down" ? this.get("topic") : null + this.mobileScrollDirection === "down" ? this.topic : null ); } } diff --git a/app/assets/javascripts/discourse/components/discovery-topics-list.js.es6 b/app/assets/javascripts/discourse/components/discovery-topics-list.js.es6 index fdc448f3eef..8290cae4bc7 100644 --- a/app/assets/javascripts/discourse/components/discovery-topics-list.js.es6 +++ b/app/assets/javascripts/discourse/components/discovery-topics-list.js.es6 @@ -24,7 +24,7 @@ const DiscoveryTopicsListComponent = Ember.Component.extend( @observes("incomingCount") _updateTitle() { - Discourse.updateContextCount(this.get("incomingCount")); + Discourse.updateContextCount(this.incomingCount); }, saveScrollPosition() { @@ -39,12 +39,12 @@ const DiscoveryTopicsListComponent = Ember.Component.extend( actions: { loadMore() { Discourse.updateContextCount(0); - this.get("model") + this.model .loadMore() .then(hasMoreResults => { Ember.run.schedule("afterRender", () => this.saveScrollPosition()); if (!hasMoreResults) { - this.get("eyeline").flushRest(); + this.eyeline.flushRest(); } else if ($(window).height() >= $(document).height()) { this.send("loadMore"); } diff --git a/app/assets/javascripts/discourse/components/edit-category-general.js.es6 b/app/assets/javascripts/discourse/components/edit-category-general.js.es6 index faca44a4ee4..05b136ce7d4 100644 --- a/app/assets/javascripts/discourse/components/edit-category-general.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-general.js.es6 @@ -66,7 +66,7 @@ export default buildCategoryPanel("general", { "category.text_color" ) categoryBadgePreview(parentCategoryId, name, color, textColor) { - const category = this.get("category"); + const category = this.category; const c = Category.create({ name, color, diff --git a/app/assets/javascripts/discourse/components/edit-category-security.js.es6 b/app/assets/javascripts/discourse/components/edit-category-security.js.es6 index 720528b66f7..129fc827937 100644 --- a/app/assets/javascripts/discourse/components/edit-category-security.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-security.js.es6 @@ -15,7 +15,7 @@ export default buildCategoryPanel("security", { addPermission(group, id) { if (!this.get("category.is_special")) { - this.get("category").addPermission({ + this.category.addPermission({ group_name: group + "", permission: PermissionType.create({ id: parseInt(id) }) }); @@ -29,7 +29,7 @@ export default buildCategoryPanel("security", { removePermission(permission) { if (!this.get("category.is_special")) { - this.get("category").removePermission(permission); + this.category.removePermission(permission); } } } diff --git a/app/assets/javascripts/discourse/components/edit-category-tab.js.es6 b/app/assets/javascripts/discourse/components/edit-category-tab.js.es6 index 50fd860f2b2..c36ec0175a9 100644 --- a/app/assets/javascripts/discourse/components/edit-category-tab.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-tab.js.es6 @@ -23,7 +23,7 @@ export default Ember.Component.extend({ }, _addToCollection: function() { - this.get("panels").addObject(this.get("tabClassName")); + this.panels.addObject(this.tabClassName); }, _resetModalScrollState() { @@ -37,7 +37,7 @@ export default Ember.Component.extend({ actions: { select: function() { - this.set("selectedTab", this.get("tab")); + this.set("selectedTab", this.tab); this._resetModalScrollState(); } } diff --git a/app/assets/javascripts/discourse/components/edit-category-topic-template.js.es6 b/app/assets/javascripts/discourse/components/edit-category-topic-template.js.es6 index 6a1da99a592..ab643885a43 100644 --- a/app/assets/javascripts/discourse/components/edit-category-topic-template.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-topic-template.js.es6 @@ -2,7 +2,7 @@ import { buildCategoryPanel } from "discourse/components/edit-category-panel"; export default buildCategoryPanel("topic-template", { _activeTabChanged: function() { - if (this.get("activeTab")) { + if (this.activeTab) { Ember.run.scheduleOnce("afterRender", () => this.$(".d-editor-input").focus() ); diff --git a/app/assets/javascripts/discourse/components/edit-topic-timer-form.js.es6 b/app/assets/javascripts/discourse/components/edit-topic-timer-form.js.es6 index f3eb28e7c72..1f65b8797d3 100644 --- a/app/assets/javascripts/discourse/components/edit-topic-timer-form.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-topic-timer-form.js.es6 @@ -71,7 +71,7 @@ export default Ember.Component.extend({ @observes("selection") _updateBasedOnLastPost() { - if (!this.get("autoClose")) { + if (!this.autoClose) { Ember.run.schedule("afterRender", () => { this.set("topicTimer.based_on_last_post", false); }); diff --git a/app/assets/javascripts/discourse/components/emoji-picker.js.es6 b/app/assets/javascripts/discourse/components/emoji-picker.js.es6 index 7ea07b9b961..b5e026a7f39 100644 --- a/app/assets/javascripts/discourse/components/emoji-picker.js.es6 +++ b/app/assets/javascripts/discourse/components/emoji-picker.js.es6 @@ -61,7 +61,7 @@ export default Ember.Component.extend({ this._checkVisibleSection(true); if ( - (!this.site.isMobileDevice || this.get("isEditorFocused")) && + (!this.site.isMobileDevice || this.isEditorFocused) && !safariHacksDisabled() ) this.$filter.find("input[name='filter']").focus(); @@ -104,12 +104,12 @@ export default Ember.Component.extend({ @on("didUpdateAttrs") _setState() { - this.get("active") ? this.show() : this.close(); + this.active ? this.show() : this.close(); }, @observes("filter") filterChanged() { - this.$filter.find(".clear-filter").toggle(!_.isEmpty(this.get("filter"))); + this.$filter.find(".clear-filter").toggle(!_.isEmpty(this.filter)); const filterDelay = this.site.isMobileDevice ? 400 : 250; run.debounce(this, this._filterEmojisList, filterDelay); }, @@ -118,7 +118,7 @@ export default Ember.Component.extend({ selectedDiversityChanged() { keyValueStore.setObject({ key: EMOJI_SELECTED_DIVERSITY, - value: this.get("selectedDiversity") + value: this.selectedDiversity }); $.each( @@ -130,7 +130,7 @@ export default Ember.Component.extend({ } ); - if (this.get("filter") !== "") { + if (this.filter !== "") { $.each(this.$results.find(".emoji.diversity"), (_, button) => this._setButtonBackground(button, true) ); @@ -151,7 +151,7 @@ export default Ember.Component.extend({ let persistScrollPosition = !$recentCategory.is(":visible") ? true : false; // we set height to 0 to avoid it being taken into account for scroll position - if (_.isEmpty(this.get("recentEmojis"))) { + if (_.isEmpty(this.recentEmojis)) { $recentCategory.hide(); $recentSection.css("height", 0).hide(); } else { @@ -159,7 +159,7 @@ export default Ember.Component.extend({ $recentSection.css("height", "auto").show(); } - const recentEmojis = this.get("recentEmojis").map(code => { + const recentEmojis = this.recentEmojis.map(code => { return { code, src: emojiUrlFor(code) }; }); const template = findRawTemplate("emoji-picker-recent")({ recentEmojis }); @@ -177,7 +177,7 @@ export default Ember.Component.extend({ $diversityPicker.find(".diversity-scale").removeClass("selected"); $diversityPicker - .find(`.diversity-scale[data-level="${this.get("selectedDiversity")}"]`) + .find(`.diversity-scale[data-level="${this.selectedDiversity}"]`) .addClass("selected"); }, @@ -236,12 +236,12 @@ export default Ember.Component.extend({ }, _filterEmojisList() { - if (this.get("filter") === "") { + if (this.filter === "") { this.$filter.find("input[name='filter']").val(""); this.$results.empty().hide(); this.$list.css("visibility", "visible"); } else { - const lowerCaseFilter = this.get("filter").toLowerCase(); + const lowerCaseFilter = this.filter.toLowerCase(); const filteredCodes = emojiSearch(lowerCaseFilter, { maxResults: 30 }); this.$results .empty() @@ -410,7 +410,7 @@ export default Ember.Component.extend({ return sectionTop + $section.height() > 0 && sectionTop < listHeight; }); - if (!_.isEmpty(this.get("recentEmojis")) && this.scrollPosition === 0) { + if (!_.isEmpty(this.recentEmojis) && this.scrollPosition === 0) { $selectedSection = $(_.first(this.$visibleSections)); } else { $selectedSection = $(_.last(this.$visibleSections)); @@ -476,7 +476,7 @@ export default Ember.Component.extend({ }, _positionPicker() { - if (!this.get("active")) { + if (!this.active) { return; } @@ -528,7 +528,7 @@ export default Ember.Component.extend({ this.$picker.css(_.merge(attributes, options)); }; - if (Ember.testing || !this.get("automaticPositioning")) { + if (Ember.testing || !this.automaticPositioning) { desktopPositioning(); return; } @@ -581,8 +581,8 @@ export default Ember.Component.extend({ }, _codeWithDiversity(code, diversity) { - if (diversity && this.get("selectedDiversity") !== 1) { - return `${code}:t${this.get("selectedDiversity")}`; + if (diversity && this.selectedDiversity !== 1) { + return `${code}:t${this.selectedDiversity}`; } else { return code; } diff --git a/app/assets/javascripts/discourse/components/expand-post.js.es6 b/app/assets/javascripts/discourse/components/expand-post.js.es6 index 9e394d17ba7..4bd2b8d4a57 100644 --- a/app/assets/javascripts/discourse/components/expand-post.js.es6 +++ b/app/assets/javascripts/discourse/components/expand-post.js.es6 @@ -10,9 +10,9 @@ export default Ember.Component.extend({ if (this._loading) { return false; } - const item = this.get("item"); + const item = this.item; - if (this.get("expanded")) { + if (this.expanded) { this.set("expanded", false); item.set("expandedExcerpt", null); return; diff --git a/app/assets/javascripts/discourse/components/featured-topic.js.es6 b/app/assets/javascripts/discourse/components/featured-topic.js.es6 index 0295c9bb485..eb0bde08ad7 100644 --- a/app/assets/javascripts/discourse/components/featured-topic.js.es6 +++ b/app/assets/javascripts/discourse/components/featured-topic.js.es6 @@ -5,7 +5,7 @@ export default Ember.Component.extend({ const $target = $(e.target); if ($target.closest(".last-posted-at").length) { this.appEvents.trigger("topic-entrance:show", { - topic: this.get("topic"), + topic: this.topic, position: $target.offset() }); return false; diff --git a/app/assets/javascripts/discourse/components/flag-selection.js.es6 b/app/assets/javascripts/discourse/components/flag-selection.js.es6 index 1387ae8819a..ca02fd03bde 100644 --- a/app/assets/javascripts/discourse/components/flag-selection.js.es6 +++ b/app/assets/javascripts/discourse/components/flag-selection.js.es6 @@ -5,7 +5,7 @@ export default Ember.Component.extend({ _selectRadio() { this.$("input[type='radio']").prop("checked", false); - const nameKey = this.get("nameKey"); + const nameKey = this.nameKey; if (!nameKey) { return; } diff --git a/app/assets/javascripts/discourse/components/footer-nav.js.es6 b/app/assets/javascripts/discourse/components/footer-nav.js.es6 index 0cbf317a8a5..8e1a4e8a2f3 100644 --- a/app/assets/javascripts/discourse/components/footer-nav.js.es6 +++ b/app/assets/javascripts/discourse/components/footer-nav.js.es6 @@ -137,20 +137,20 @@ const FooterNavComponent = MountWidget.extend( }, goBack() { - this.set("currentRouteIndex", this.get("currentRouteIndex") - 1); + this.set("currentRouteIndex", this.currentRouteIndex - 1); this.backForwardClicked = true; window.history.back(); }, goForward() { - this.set("currentRouteIndex", this.get("currentRouteIndex") + 1); + this.set("currentRouteIndex", this.currentRouteIndex + 1); this.backForwardClicked = true; window.history.forward(); }, @observes("currentRouteIndex") setBackForward() { - let index = this.get("currentRouteIndex"); + let index = this.currentRouteIndex; this.set("canGoBack", index > 1 || document.referrer ? true : false); this.set("canGoForward", index < this.routeHistory.length ? true : false); diff --git a/app/assets/javascripts/discourse/components/future-date-input.js.es6 b/app/assets/javascripts/discourse/components/future-date-input.js.es6 index 9d6a470ab1b..45221ac7193 100644 --- a/app/assets/javascripts/discourse/components/future-date-input.js.es6 +++ b/app/assets/javascripts/discourse/components/future-date-input.js.es6 @@ -22,10 +22,10 @@ export default Ember.Component.extend({ init() { this._super(...arguments); - const input = this.get("input"); + const input = this.input; if (input) { - if (this.get("basedOnLastPost")) { + if (this.basedOnLastPost) { this.set("selection", "set_based_on_last_post"); } else { this.set("selection", "pick_date_and_time"); @@ -39,14 +39,14 @@ export default Ember.Component.extend({ @observes("date", "time") _updateInput() { - const date = moment(this.get("date")).format("YYYY-MM-DD"); - const time = (this.get("time") && ` ${this.get("time")}`) || ""; + const date = moment(this.date).format("YYYY-MM-DD"); + const time = (this.time && ` ${this.time}`) || ""; this.set("input", moment(`${date}${time}`).format(FORMAT)); }, @observes("isBasedOnLastPost") _updateBasedOnLastPost() { - this.set("basedOnLastPost", this.get("isBasedOnLastPost")); + this.set("basedOnLastPost", this.isBasedOnLastPost); }, @computed("input", "isBasedOnLastPost") @@ -72,7 +72,7 @@ export default Ember.Component.extend({ }, didReceiveAttrs() { - if (this.get("label")) this.set("displayLabel", I18n.t(this.get("label"))); + if (this.label) this.set("displayLabel", I18n.t(this.label)); }, @computed( diff --git a/app/assets/javascripts/discourse/components/group-card-contents.js.es6 b/app/assets/javascripts/discourse/components/group-card-contents.js.es6 index 994e5533663..2c3df56b1ff 100644 --- a/app/assets/javascripts/discourse/components/group-card-contents.js.es6 +++ b/app/assets/javascripts/discourse/components/group-card-contents.js.es6 @@ -76,7 +76,7 @@ export default Ember.Component.extend(CardContentsBase, CleansUp, { }, cancelFilter() { - const postStream = this.get("postStream"); + const postStream = this.postStream; postStream.cancelFilter(); postStream.refresh(); this._close(); diff --git a/app/assets/javascripts/discourse/components/group-index-toggle.js.es6 b/app/assets/javascripts/discourse/components/group-index-toggle.js.es6 index 25c18c4cdae..8a35118a891 100644 --- a/app/assets/javascripts/discourse/components/group-index-toggle.js.es6 +++ b/app/assets/javascripts/discourse/components/group-index-toggle.js.es6 @@ -9,17 +9,17 @@ export default Ember.Component.extend( buildBuffer(buffer) { buffer.push(""); - buffer.push(I18n.t(this.get("i18nKey"))); + buffer.push(I18n.t(this.i18nKey)); - if (this.get("field") === this.get("order")) { - buffer.push(iconHTML(this.get("desc") ? "chevron-down" : "chevron-up")); + if (this.field === this.order) { + buffer.push(iconHTML(this.desc ? "chevron-down" : "chevron-up")); } buffer.push(""); }, click() { - if (this.get("order") === this.field) { - this.set("desc", this.get("desc") ? null : true); + if (this.order === this.field) { + this.set("desc", this.desc ? null : true); } else { this.setProperties({ order: this.field, desc: null }); } diff --git a/app/assets/javascripts/discourse/components/group-manage-save-button.js.es6 b/app/assets/javascripts/discourse/components/group-manage-save-button.js.es6 index 3e59ad6f20e..1487151fde7 100644 --- a/app/assets/javascripts/discourse/components/group-manage-save-button.js.es6 +++ b/app/assets/javascripts/discourse/components/group-manage-save-button.js.es6 @@ -14,7 +14,7 @@ export default Ember.Component.extend({ save() { this.set("saving", true); - return this.get("model") + return this.model .save() .then(() => { this.set("saved", true); diff --git a/app/assets/javascripts/discourse/components/group-member-dropdown.js.es6 b/app/assets/javascripts/discourse/components/group-member-dropdown.js.es6 index 4b3c16f8b49..6cd50f87a75 100644 --- a/app/assets/javascripts/discourse/components/group-member-dropdown.js.es6 +++ b/app/assets/javascripts/discourse/components/group-member-dropdown.js.es6 @@ -52,13 +52,13 @@ export default DropdownSelectBoxComponent.extend({ mutateValue(id) { switch (id) { case "removeMember": - this.removeMember(this.get("member")); + this.removeMember(this.member); break; case "makeOwner": this.makeOwner(this.get("member.username")); break; case "removeOwner": - this.removeOwner(this.get("member")); + this.removeOwner(this.member); break; } } diff --git a/app/assets/javascripts/discourse/components/group-member.js.es6 b/app/assets/javascripts/discourse/components/group-member.js.es6 index 019867d5253..be68373fa7d 100644 --- a/app/assets/javascripts/discourse/components/group-member.js.es6 +++ b/app/assets/javascripts/discourse/components/group-member.js.es6 @@ -3,7 +3,7 @@ export default Ember.Component.extend({ actions: { remove() { - this.removeAction(this.get("member")); + this.removeAction(this.member); } } }); diff --git a/app/assets/javascripts/discourse/components/group-members-input.js.es6 b/app/assets/javascripts/discourse/components/group-members-input.js.es6 index 637cfca41b3..59662c26b74 100644 --- a/app/assets/javascripts/discourse/components/group-members-input.js.es6 +++ b/app/assets/javascripts/discourse/components/group-members-input.js.es6 @@ -33,11 +33,11 @@ export default Ember.Component.extend({ actions: { next() { - if (this.get("showingLast")) { + if (this.showingLast) { return; } - const group = this.get("model"); + const group = this.model; const offset = Math.min( group.get("offset") + group.get("limit"), group.get("user_count") @@ -48,11 +48,11 @@ export default Ember.Component.extend({ }, previous() { - if (this.get("showingFirst")) { + if (this.showingFirst) { return; } - const group = this.get("model"); + const group = this.model; const offset = Math.max(group.get("offset") - group.get("limit"), 0); group.set("offset", offset); @@ -63,7 +63,7 @@ export default Ember.Component.extend({ if (Ember.isEmpty(this.get("model.usernames"))) { return; } - this.get("model") + this.model .addMembers(this.get("model.usernames")) .catch(popupAjaxError); this.set("model.usernames", null); @@ -81,7 +81,7 @@ export default Ember.Component.extend({ I18n.t("yes_value"), confirm => { if (confirm) { - this.get("model").removeMember(member); + this.model.removeMember(member); } } ); diff --git a/app/assets/javascripts/discourse/components/group-membership-button.js.es6 b/app/assets/javascripts/discourse/components/group-membership-button.js.es6 index 420a3f1c9a1..31ac1717345 100644 --- a/app/assets/javascripts/discourse/components/group-membership-button.js.es6 +++ b/app/assets/javascripts/discourse/components/group-membership-button.js.es6 @@ -34,7 +34,7 @@ export default Ember.Component.extend({ joinGroup() { if (this.currentUser) { this.set("updatingMembership", true); - const model = this.get("model"); + const model = this.model; model .addMembers(this.currentUser.get("username")) @@ -52,7 +52,7 @@ export default Ember.Component.extend({ leaveGroup() { this.set("updatingMembership", true); - const model = this.get("model"); + const model = this.model; model .removeMember(this.currentUser) @@ -68,7 +68,7 @@ export default Ember.Component.extend({ showRequestMembershipForm() { if (this.currentUser) { showModal("request-group-membership-form", { - model: this.get("model") + model: this.model }); } else { this._showLoginModal(); diff --git a/app/assets/javascripts/discourse/components/group-selector.js.es6 b/app/assets/javascripts/discourse/components/group-selector.js.es6 index dc3db235679..9447f63875e 100644 --- a/app/assets/javascripts/discourse/components/group-selector.js.es6 +++ b/app/assets/javascripts/discourse/components/group-selector.js.es6 @@ -13,14 +13,14 @@ export default Ember.Component.extend({ @observes("groupNames") _update() { - if (this.get("canReceiveUpdates") === "true") + if (this.canReceiveUpdates === "true") this._initializeAutocomplete({ updateData: true }); }, @on("didInsertElement") _initializeAutocomplete(opts) { let selectedGroups; - let groupNames = this.get("groupNames"); + let groupNames = this.groupNames; this.$("input").autocomplete({ allowAny: false, @@ -29,8 +29,8 @@ export default Ember.Component.extend({ : Ember.isEmpty(groupNames) ? [] : [groupNames], - single: this.get("single"), - fullWidthWrap: this.get("fullWidthWrap"), + single: this.single, + fullWidthWrap: this.fullWidthWrap, updateData: opts && opts.updateData ? opts.updateData : false, onChangeItems: items => { selectedGroups = items; @@ -40,7 +40,7 @@ export default Ember.Component.extend({ return g.name; }, dataSource: term => { - return this.get("groupFinder")(term).then(groups => { + return this.groupFinder(term).then(groups => { if (!selectedGroups) return groups; return groups.filter(group => { diff --git a/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 b/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 index 87482639a6c..15c2efbd96a 100644 --- a/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 +++ b/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 @@ -30,7 +30,7 @@ export default Ember.Component.extend({ @observes("nameInput") _validateName() { - name = this.get("nameInput"); + name = this.nameInput; if (name === this.get("model.name")) return; if (name === undefined) { @@ -62,7 +62,7 @@ export default Ember.Component.extend({ }, checkGroupName: debounce(function() { - name = this.get("nameInput"); + name = this.nameInput; if (Ember.isEmpty(name)) return; Group.checkName(name).then(response => { @@ -78,7 +78,7 @@ export default Ember.Component.extend({ ); this.set("disableSave", false); - this.set("model.name", this.get("nameInput")); + this.set("model.name", this.nameInput); } else { let reason; diff --git a/app/assets/javascripts/discourse/components/highlight-text.js.es6 b/app/assets/javascripts/discourse/components/highlight-text.js.es6 index 3242f2754b7..73c2b045bc7 100644 --- a/app/assets/javascripts/discourse/components/highlight-text.js.es6 +++ b/app/assets/javascripts/discourse/components/highlight-text.js.es6 @@ -4,7 +4,7 @@ export default Ember.Component.extend({ tagName: "span", _highlightOnInsert: function() { - const term = this.get("highlight"); + const term = this.highlight; highlightText(this.$(), term); } .observes("highlight") diff --git a/app/assets/javascripts/discourse/components/ignored-user-list-item.js.es6 b/app/assets/javascripts/discourse/components/ignored-user-list-item.js.es6 index 8a41fe7c337..5bf27c13a16 100644 --- a/app/assets/javascripts/discourse/components/ignored-user-list-item.js.es6 +++ b/app/assets/javascripts/discourse/components/ignored-user-list-item.js.es6 @@ -3,7 +3,7 @@ export default Ember.Component.extend({ items: null, actions: { removeIgnoredUser(item) { - this.get("onRemoveIgnoredUser")(item); + this.onRemoveIgnoredUser(item); } } }); diff --git a/app/assets/javascripts/discourse/components/ignored-user-list.js.es6 b/app/assets/javascripts/discourse/components/ignored-user-list.js.es6 index 5fd0a6f486b..9c951dfeed1 100644 --- a/app/assets/javascripts/discourse/components/ignored-user-list.js.es6 +++ b/app/assets/javascripts/discourse/components/ignored-user-list.js.es6 @@ -7,7 +7,7 @@ export default Ember.Component.extend({ actions: { removeIgnoredUser(item) { this.set("saved", false); - this.get("items").removeObject(item); + this.items.removeObject(item); User.findByUsername(item).then(user => { user .updateNotificationLevel("normal") @@ -17,11 +17,11 @@ export default Ember.Component.extend({ }, newIgnoredUser() { const modal = showModal("ignore-duration-with-username", { - model: this.get("model") + model: this.model }); modal.setProperties({ onUserIgnored: username => { - this.get("items").addObject(username); + this.items.addObject(username); } }); } diff --git a/app/assets/javascripts/discourse/components/image-uploader.js.es6 b/app/assets/javascripts/discourse/components/image-uploader.js.es6 index ec52913c99f..6bdb84553a2 100644 --- a/app/assets/javascripts/discourse/components/image-uploader.js.es6 +++ b/app/assets/javascripts/discourse/components/image-uploader.js.es6 @@ -80,19 +80,19 @@ export default Ember.Component.extend(UploadMixin, { }, _applyLightbox() { - if (this.get("imageUrl")) Ember.run.next(() => lightbox(this.$())); + if (this.imageUrl) Ember.run.next(() => lightbox(this.$())); }, actions: { toggleLightbox() { - if (this.get("imageFilename")) { + if (this.imageFilename) { this._openLightbox(); } else { this.set("loadingLightbox", true); ajax(`/uploads/lookup-metadata`, { type: "POST", - data: { url: this.get("imageUrl") } + data: { url: this.imageUrl } }) .then(json => { this.setProperties({ diff --git a/app/assets/javascripts/discourse/components/input-tip.js.es6 b/app/assets/javascripts/discourse/components/input-tip.js.es6 index 6c7688c0944..b2ad93590eb 100644 --- a/app/assets/javascripts/discourse/components/input-tip.js.es6 +++ b/app/assets/javascripts/discourse/components/input-tip.js.es6 @@ -13,7 +13,7 @@ export default Ember.Component.extend( const reason = this.get("validation.reason"); if (reason) { buffer.push( - iconHTML(this.get("good") ? "check" : "times") + " " + reason + iconHTML(this.good ? "check" : "times") + " " + reason ); } } diff --git a/app/assets/javascripts/discourse/components/invite-panel.js.es6 b/app/assets/javascripts/discourse/components/invite-panel.js.es6 index 3fca499f417..feeae1b8fee 100644 --- a/app/assets/javascripts/discourse/components/invite-panel.js.es6 +++ b/app/assets/javascripts/discourse/components/invite-panel.js.es6 @@ -127,7 +127,7 @@ export default Ember.Component.extend({ @computed("inviteModel", "inviteModel.details.can_invite_via_email") canInviteViaEmail(inviteModel, canInviteViaEmail) { - return this.get("inviteModel") === this.currentUser + return this.inviteModel === this.currentUser ? true : canInviteViaEmail; }, @@ -185,7 +185,7 @@ export default Ember.Component.extend({ @computed("emailOrUsername") showCustomMessage(emailOrUsername) { return ( - this.get("inviteModel") === this.currentUser || + this.inviteModel === this.currentUser || emailValid(emailOrUsername) ); }, @@ -247,7 +247,7 @@ export default Ember.Component.extend({ @computed("isPM", "emailOrUsername", "invitingExistingUserToTopic") successMessage(isPM, emailOrUsername, invitingExistingUserToTopic) { - if (this.get("hasGroups")) { + if (this.hasGroups) { return I18n.t("topic.invite_private.success_group"); } else if (isPM) { return I18n.t("topic.invite_private.success"); @@ -287,7 +287,7 @@ export default Ember.Component.extend({ invitingExistingUserToTopic: false }); - this.get("inviteModel").setProperties({ + this.inviteModel.setProperties({ groupNames: null, error: false, saving: false, @@ -298,14 +298,14 @@ export default Ember.Component.extend({ actions: { createInvite() { - if (this.get("disabled")) { + if (this.disabled) { return; } const groupNames = this.get("inviteModel.groupNames"); - const userInvitedController = this.get("userInvitedShow"); + const userInvitedController = this.userInvitedShow; - const model = this.get("inviteModel"); + const model = this.inviteModel; model.setProperties({ saving: true, error: false }); const onerror = e => { @@ -314,7 +314,7 @@ export default Ember.Component.extend({ } else { this.set( "errorMessage", - this.get("isPM") + this.isPM ? I18n.t("topic.invite_private.error") : I18n.t("topic.invite_reply.error") ); @@ -322,9 +322,9 @@ export default Ember.Component.extend({ model.setProperties({ saving: false, error: true }); }; - if (this.get("hasGroups")) { - return this.get("inviteModel") - .createGroupInvite(this.get("emailOrUsername").trim()) + if (this.hasGroups) { + return this.inviteModel + .createGroupInvite(this.emailOrUsername.trim()) .then(data => { model.setProperties({ saving: false, finished: true }); this.get("inviteModel.details.allowed_groups").pushObject( @@ -334,15 +334,15 @@ export default Ember.Component.extend({ }) .catch(onerror); } else { - return this.get("inviteModel") + return this.inviteModel .createInvite( - this.get("emailOrUsername").trim(), + this.emailOrUsername.trim(), groupNames, - this.get("customMessage") + this.customMessage ) .then(result => { model.setProperties({ saving: false, finished: true }); - if (!this.get("invitingToTopic") && userInvitedController) { + if (!this.invitingToTopic && userInvitedController) { Invite.findInvitedBy( this.currentUser, userInvitedController.get("filter") @@ -352,14 +352,14 @@ export default Ember.Component.extend({ totalInvites: inviteModel.invites.length }); }); - } else if (this.get("isPM") && result && result.user) { + } else if (this.isPM && result && result.user) { this.get("inviteModel.details.allowed_users").pushObject( Ember.Object.create(result.user) ); this.appEvents.trigger("post-stream:refresh"); } else if ( - this.get("invitingToTopic") && - emailValid(this.get("emailOrUsername").trim()) && + this.invitingToTopic && + emailValid(this.emailOrUsername.trim()) && result && result.user ) { @@ -371,23 +371,23 @@ export default Ember.Component.extend({ }, generateInvitelink() { - if (this.get("disabled")) { + if (this.disabled) { return; } const groupNames = this.get("inviteModel.groupNames"); - const userInvitedController = this.get("userInvitedShow"); - const model = this.get("inviteModel"); + const userInvitedController = this.userInvitedShow; + const model = this.inviteModel; model.setProperties({ saving: true, error: false }); let topicId; - if (this.get("invitingToTopic")) { + if (this.invitingToTopic) { topicId = this.get("inviteModel.id"); } return model .generateInviteLink( - this.get("emailOrUsername").trim(), + this.emailOrUsername.trim(), groupNames, topicId ) @@ -416,7 +416,7 @@ export default Ember.Component.extend({ } else { this.set( "errorMessage", - this.get("isPM") + this.isPM ? I18n.t("topic.invite_private.error") : I18n.t("topic.invite_reply.error") ); @@ -427,8 +427,8 @@ export default Ember.Component.extend({ showCustomMessageBox() { this.toggleProperty("hasCustomMessage"); - if (this.get("hasCustomMessage")) { - if (this.get("inviteModel") === this.currentUser) { + if (this.hasCustomMessage) { + if (this.inviteModel === this.currentUser) { this.set( "customMessage", I18n.t("invite.custom_message_template_forum") diff --git a/app/assets/javascripts/discourse/components/latest-topic-list-item.js.es6 b/app/assets/javascripts/discourse/components/latest-topic-list-item.js.es6 index ef38e8266b4..487ae8aa46d 100644 --- a/app/assets/javascripts/discourse/components/latest-topic-list-item.js.es6 +++ b/app/assets/javascripts/discourse/components/latest-topic-list-item.js.es6 @@ -20,7 +20,7 @@ export default Ember.Component.extend({ return false; } - return this.unhandledRowClick(e, this.get("topic")); + return this.unhandledRowClick(e, this.topic); }, // Can be overwritten by plugins to handle clicks on other parts of the row diff --git a/app/assets/javascripts/discourse/components/link-to-input.js.es6 b/app/assets/javascripts/discourse/components/link-to-input.js.es6 index 15c66c41aa2..34eaedc7d4a 100644 --- a/app/assets/javascripts/discourse/components/link-to-input.js.es6 +++ b/app/assets/javascripts/discourse/components/link-to-input.js.es6 @@ -2,7 +2,7 @@ export default Ember.Component.extend({ showInput: false, click() { - this.get("onClick")(); + this.onClick(); Ember.run.schedule("afterRender", () => { this.$() diff --git a/app/assets/javascripts/discourse/components/load-more.js.es6 b/app/assets/javascripts/discourse/components/load-more.js.es6 index a4b37f72dd7..f81b33b7642 100644 --- a/app/assets/javascripts/discourse/components/load-more.js.es6 +++ b/app/assets/javascripts/discourse/components/load-more.js.es6 @@ -4,7 +4,7 @@ export default Ember.Component.extend(LoadMore, { init() { this._super(...arguments); - this.set("eyelineSelector", this.get("selector")); + this.set("eyelineSelector", this.selector); }, actions: { diff --git a/app/assets/javascripts/discourse/components/mobile-nav.js.es6 b/app/assets/javascripts/discourse/components/mobile-nav.js.es6 index 3638eaca8f5..f63183b217a 100644 --- a/app/assets/javascripts/discourse/components/mobile-nav.js.es6 +++ b/app/assets/javascripts/discourse/components/mobile-nav.js.es6 @@ -4,7 +4,7 @@ export default Ember.Component.extend({ @on("init") _init() { if (!this.get("site.mobileView")) { - var classes = this.get("desktopClass"); + var classes = this.desktopClass; if (classes) { classes = classes.split(" "); this.set("classNames", classes); @@ -39,7 +39,7 @@ export default Ember.Component.extend({ this.toggleProperty("expanded"); Ember.run.next(() => { - if (this.get("expanded")) { + if (this.expanded) { $(window) .off("click.mobile-nav") .on("click.mobile-nav", e => { diff --git a/app/assets/javascripts/discourse/components/modal-tab.js.es6 b/app/assets/javascripts/discourse/components/modal-tab.js.es6 index 275581a2936..c7a392507cd 100644 --- a/app/assets/javascripts/discourse/components/modal-tab.js.es6 +++ b/app/assets/javascripts/discourse/components/modal-tab.js.es6 @@ -12,6 +12,6 @@ export default Ember.Component.extend({ isActive: propertyEqual("panel.id", "selectedPanel.id"), click() { - this.onSelectPanel(this.get("panel")); + this.onSelectPanel(this.panel); } }); diff --git a/app/assets/javascripts/discourse/components/mount-widget.js.es6 b/app/assets/javascripts/discourse/components/mount-widget.js.es6 index 7e424aeee13..eb67d3e5e5e 100644 --- a/app/assets/javascripts/discourse/components/mount-widget.js.es6 +++ b/app/assets/javascripts/discourse/components/mount-widget.js.es6 @@ -22,7 +22,7 @@ export default Ember.Component.extend({ init() { this._super(...arguments); - const name = this.get("widget"); + const name = this.widget; this.register = getRegister(this); @@ -49,7 +49,7 @@ export default Ember.Component.extend({ }, willClearRender() { - const callbacks = _cleanCallbacks[this.get("widget")]; + const callbacks = _cleanCallbacks[this.widget]; if (callbacks) { callbacks.forEach(cb => cb()); } @@ -106,9 +106,9 @@ export default Ember.Component.extend({ } const t0 = new Date().getTime(); - const args = this.get("args") || this.buildArgs(); + const args = this.args || this.buildArgs(); const opts = { - model: this.get("model"), + model: this.model, dirtyKeys: this.dirtyKeys }; const newTree = new this._widgetClass(args, this.register, opts); diff --git a/app/assets/javascripts/discourse/components/nav-item.js.es6 b/app/assets/javascripts/discourse/components/nav-item.js.es6 index 20d6d8049f4..2cff2954038 100644 --- a/app/assets/javascripts/discourse/components/nav-item.js.es6 +++ b/app/assets/javascripts/discourse/components/nav-item.js.es6 @@ -22,11 +22,11 @@ export default Ember.Component.extend({ return; } - const routeParam = this.get("routeParam"); + const routeParam = this.routeParam; if (routeParam && currentRoute) { return currentRoute.params["filter"] === routeParam; } - return this.get("router").isActive(route); + return this.router.isActive(route); } }); diff --git a/app/assets/javascripts/discourse/components/navigation-bar.js.es6 b/app/assets/javascripts/discourse/components/navigation-bar.js.es6 index 7d8adf0010d..de4ba53a1d7 100644 --- a/app/assets/javascripts/discourse/components/navigation-bar.js.es6 +++ b/app/assets/javascripts/discourse/components/navigation-bar.js.es6 @@ -24,8 +24,8 @@ export default Ember.Component.extend({ i => i.get("filterMode").indexOf(filterMode) === 0 ); if (!item) { - let connectors = this.get("connectors"); - let category = this.get("category"); + let connectors = this.connectors; + let category = this.category; if (connectors && category) { connectors.forEach(c => { if ( @@ -48,13 +48,13 @@ export default Ember.Component.extend({ @observes("expanded") closedNav() { - if (!this.get("expanded")) { + if (!this.expanded) { this.ensureDropClosed(); } }, ensureDropClosed() { - if (!this.get("expanded")) { + if (!this.expanded) { this.set("expanded", false); } $(window).off("click.navigation-bar"); @@ -63,13 +63,13 @@ export default Ember.Component.extend({ actions: { toggleDrop() { - this.set("expanded", !this.get("expanded")); + this.set("expanded", !this.expanded); - if (this.get("expanded")) { + if (this.expanded) { DiscourseURL.appEvents.on("dom:clean", this, this.ensureDropClosed); Ember.run.next(() => { - if (!this.get("expanded")) { + if (!this.expanded) { return; } diff --git a/app/assets/javascripts/discourse/components/navigation-item.js.es6 b/app/assets/javascripts/discourse/components/navigation-item.js.es6 index ae47bab740e..5ef8f99d15a 100644 --- a/app/assets/javascripts/discourse/components/navigation-item.js.es6 +++ b/app/assets/javascripts/discourse/components/navigation-item.js.es6 @@ -23,7 +23,7 @@ export default Ember.Component.extend( }, buildBuffer(buffer) { - const content = this.get("content"); + const content = this.content; let href = content.get("href"); @@ -36,7 +36,7 @@ export default Ember.Component.extend( } if ( - !this.get("active") && + !this.active && this.currentUser && this.currentUser.trust_level > 0 && (content.get("name") === "new" || content.get("name") === "unread") && @@ -48,7 +48,7 @@ export default Ember.Component.extend( } buffer.push( - `` + `` ); if (content.get("hasIcon")) { diff --git a/app/assets/javascripts/discourse/components/password-field.js.es6 b/app/assets/javascripts/discourse/components/password-field.js.es6 index a8eaf51fbfc..7740eca0c94 100644 --- a/app/assets/javascripts/discourse/components/password-field.js.es6 +++ b/app/assets/javascripts/discourse/components/password-field.js.es6 @@ -24,7 +24,7 @@ export default TextField.extend({ }, keyUp(e) { - if (e.which === 20 && this.get("canToggle")) { + if (e.which === 20 && this.canToggle) { this.toggleProperty("capsLockOn"); } }, diff --git a/app/assets/javascripts/discourse/components/plugin-connector.js.es6 b/app/assets/javascripts/discourse/components/plugin-connector.js.es6 index b0bfad2d398..b5df63aa8fe 100644 --- a/app/assets/javascripts/discourse/components/plugin-connector.js.es6 +++ b/app/assets/javascripts/discourse/components/plugin-connector.js.es6 @@ -4,10 +4,10 @@ export default Ember.Component.extend({ init() { this._super(...arguments); - const connector = this.get("connector"); + const connector = this.connector; this.set("layoutName", connector.templateName); - const args = this.get("args") || {}; + const args = this.args || {}; Object.keys(args).forEach(key => this.set(key, args[key])); const connectorClass = this.get("connector.connectorClass"); @@ -18,7 +18,7 @@ export default Ember.Component.extend({ @observes("args") _argsChanged() { - const args = this.get("args") || {}; + const args = this.args || {}; Object.keys(args).forEach(key => this.set(key, args[key])); }, diff --git a/app/assets/javascripts/discourse/components/plugin-outlet.js.es6 b/app/assets/javascripts/discourse/components/plugin-outlet.js.es6 index 97f56b29211..36b89291575 100644 --- a/app/assets/javascripts/discourse/components/plugin-outlet.js.es6 +++ b/app/assets/javascripts/discourse/components/plugin-outlet.js.es6 @@ -37,15 +37,15 @@ export default Ember.Component.extend({ init() { // This should be the future default - if (this.get("noTags")) { + if (this.noTags) { this.set("tagName", ""); this.set("connectorTagName", ""); } this._super(...arguments); - const name = this.get("name"); + const name = this.name; if (name) { - const args = this.get("args"); + const args = this.args; this.set("connectors", renderedConnectorsFor(name, args, this)); } } diff --git a/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 b/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 index f951756d907..3088ca25a48 100644 --- a/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 +++ b/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 @@ -28,7 +28,7 @@ export default Ember.Component.extend( @observes("lastShownAt") bounce() { - if (this.get("lastShownAt")) { + if (this.lastShownAt) { var $elem = this.$(); if (!this.animateAttribute) { this.animateAttribute = diff --git a/app/assets/javascripts/discourse/components/preference-checkbox.js.es6 b/app/assets/javascripts/discourse/components/preference-checkbox.js.es6 index 1b858735a24..b0e84c117d2 100644 --- a/app/assets/javascripts/discourse/components/preference-checkbox.js.es6 +++ b/app/assets/javascripts/discourse/components/preference-checkbox.js.es6 @@ -9,9 +9,9 @@ export default Ember.Component.extend({ }, change() { - const warning = this.get("warning"); + const warning = this.warning; - if (warning && this.get("checked")) { + if (warning && this.checked) { this.warning(); return false; } diff --git a/app/assets/javascripts/discourse/components/quote-button.js.es6 b/app/assets/javascripts/discourse/components/quote-button.js.es6 index 2db85835beb..2636fc8e412 100644 --- a/app/assets/javascripts/discourse/components/quote-button.js.es6 +++ b/app/assets/javascripts/discourse/components/quote-button.js.es6 @@ -10,16 +10,16 @@ export default Ember.Component.extend({ _reselected: false, _hideButton() { - this.get("quoteState").clear(); + this.quoteState.clear(); this.set("visible", false); }, _selectionChanged() { - const quoteState = this.get("quoteState"); + const quoteState = this.quoteState; const selection = window.getSelection(); if (selection.isCollapsed) { - if (this.get("visible")) { + if (this.visible) { this._hideButton(); } return; @@ -39,7 +39,7 @@ export default Ember.Component.extend({ postId = postId || $ancestor.closest(".boxed, .reply").data("post-id"); if ($ancestor.closest(".contents").length === 0 || !postId) { - if (this.get("visible")) { + if (this.visible) { this._hideButton(); } return; @@ -157,7 +157,7 @@ export default Ember.Component.extend({ }, click() { - const { postId, buffer } = this.get("quoteState"); + const { postId, buffer } = this.quoteState; this.attrs.selectText(postId, buffer).then(() => this._hideButton()); return false; } diff --git a/app/assets/javascripts/discourse/components/radio-button.js.es6 b/app/assets/javascripts/discourse/components/radio-button.js.es6 index d1624fa5685..8cdf74ecb97 100644 --- a/app/assets/javascripts/discourse/components/radio-button.js.es6 +++ b/app/assets/javascripts/discourse/components/radio-button.js.es6 @@ -13,7 +13,7 @@ export default Ember.Component.extend({ click() { const value = this.$().val(); - if (this.get("selection") === value) { + if (this.selection === value) { this.set("selection", undefined); } this.set("selection", value); diff --git a/app/assets/javascripts/discourse/components/reviewable-claimed-topic.js.es6 b/app/assets/javascripts/discourse/components/reviewable-claimed-topic.js.es6 index 8d9bd6c2701..d73a32d304d 100644 --- a/app/assets/javascripts/discourse/components/reviewable-claimed-topic.js.es6 +++ b/app/assets/javascripts/discourse/components/reviewable-claimed-topic.js.es6 @@ -12,7 +12,7 @@ export default Ember.Component.extend({ actions: { unclaim() { - ajax(`/reviewable_claimed_topics/${this.get("topicId")}`, { + ajax(`/reviewable_claimed_topics/${this.topicId}`, { method: "DELETE" }).then(() => { this.set("claimedBy", null); @@ -23,7 +23,7 @@ export default Ember.Component.extend({ let claim = this.store.createRecord("reviewable-claimed-topic"); claim - .save({ topic_id: this.get("topicId") }) + .save({ topic_id: this.topicId }) .then(() => { this.set("claimedBy", this.currentUser); }) diff --git a/app/assets/javascripts/discourse/components/reviewable-item.js.es6 b/app/assets/javascripts/discourse/components/reviewable-item.js.es6 index 27e8aeef61f..3a84d0ac07d 100644 --- a/app/assets/javascripts/discourse/components/reviewable-item.js.es6 +++ b/app/assets/javascripts/discourse/components/reviewable-item.js.es6 @@ -73,7 +73,7 @@ export default Ember.Component.extend({ }, _performConfirmed(action) { - let reviewable = this.get("reviewable"); + let reviewable = this.reviewable; let performAction = () => { let version = reviewable.get("version"); @@ -122,7 +122,7 @@ export default Ember.Component.extend({ }, _penalize(adminToolMethod, reviewable, performAction) { - let adminTools = this.get("adminTools"); + let adminTools = this.adminTools; if (adminTools) { let createdBy = reviewable.get("target_created_by"); let postId = reviewable.get("post_id"); @@ -157,7 +157,7 @@ export default Ember.Component.extend({ }); this.set("updating", true); - return this.get("reviewable") + return this.reviewable .update(updates) .then(() => this.set("editing", false)) .catch(popupAjaxError) @@ -176,7 +176,7 @@ export default Ember.Component.extend({ }, perform(action) { - if (this.get("updating")) { + if (this.updating) { return; } diff --git a/app/assets/javascripts/discourse/components/scroll-tracker.js.es6 b/app/assets/javascripts/discourse/components/scroll-tracker.js.es6 index 04d99fd8936..caad7dc87a2 100644 --- a/app/assets/javascripts/discourse/components/scroll-tracker.js.es6 +++ b/app/assets/javascripts/discourse/components/scroll-tracker.js.es6 @@ -4,20 +4,20 @@ export default Ember.Component.extend(Scrolling, { didReceiveAttrs() { this._super(...arguments); - this.set("trackerName", `scroll-tracker-${this.get("name")}`); + this.set("trackerName", `scroll-tracker-${this.name}`); }, didInsertElement() { this._super(...arguments); - this.bindScrolling({ name: this.get("name") }); + this.bindScrolling({ name: this.name }); }, didRender() { this._super(...arguments); - const data = this.session.get(this.get("trackerName")); - if (data && data.position >= 0 && data.tag === this.get("tag")) { + const data = this.session.get(this.trackerName); + if (data && data.position >= 0 && data.tag === this.tag) { Ember.run.next(() => $(window).scrollTop(data.position + 1)); } }, @@ -25,15 +25,15 @@ export default Ember.Component.extend(Scrolling, { willDestroyElement() { this._super(...arguments); - this.unbindScrolling(this.get("name")); + this.unbindScrolling(this.name); }, scrolled() { this._super(...arguments); - this.session.set(this.get("trackerName"), { + this.session.set(this.trackerName, { position: $(window).scrollTop(), - tag: this.get("tag") + tag: this.tag }); } }); diff --git a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 index cbe6564d194..f8bbabc122d 100644 --- a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 +++ b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 @@ -109,7 +109,7 @@ export default Ember.Component.extend({ }, _update() { - if (!this.get("searchTerm")) { + if (!this.searchTerm) { this._init(); return; } @@ -156,7 +156,7 @@ export default Ember.Component.extend({ }, findSearchTerms() { - const searchTerm = escapeExpression(this.get("searchTerm")); + const searchTerm = escapeExpression(this.searchTerm); if (!searchTerm) return []; const blocks = searchTerm.match(REGEXP_BLOCKS); @@ -334,7 +334,7 @@ export default Ember.Component.extend({ updateSearchTermForUsername() { const match = this.filterBlocks(REGEXP_USERNAME_PREFIX); const userFilter = this.get("searchedTerms.username"); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; if (userFilter && userFilter.length !== 0) { if (match.length !== 0) { @@ -354,7 +354,7 @@ export default Ember.Component.extend({ updateSearchTermForCategory() { const match = this.filterBlocks(REGEXP_CATEGORY_PREFIX); const categoryFilter = this.get("searchedTerms.category"); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; const slugCategoryMatches = match.length !== 0 ? match[0].match(REGEXP_CATEGORY_SLUG) : null; @@ -404,7 +404,7 @@ export default Ember.Component.extend({ updateSearchTermForGroup() { const match = this.filterBlocks(REGEXP_GROUP_PREFIX); const groupFilter = this.get("searchedTerms.group"); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; if (groupFilter && groupFilter.length !== 0) { if (match.length !== 0) { @@ -424,7 +424,7 @@ export default Ember.Component.extend({ updateSearchTermForBadge() { const match = this.filterBlocks(REGEXP_BADGE_PREFIX); const badgeFilter = this.get("searchedTerms.badge"); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; if (badgeFilter && badgeFilter.length !== 0) { if (match.length !== 0) { @@ -444,7 +444,7 @@ export default Ember.Component.extend({ updateSearchTermForTags() { const match = this.filterBlocks(REGEXP_TAGS_PREFIX); const tagFilter = this.get("searchedTerms.tags"); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; const contain_all_tags = this.get("searchedTerms.special.all_tags"); if (tagFilter && tagFilter.length !== 0) { @@ -472,7 +472,7 @@ export default Ember.Component.extend({ if (inFilter in IN_OPTIONS_MAPPING) { keyword = IN_OPTIONS_MAPPING[inFilter]; } - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; if (inFilter) { if (match.length !== 0) { @@ -491,7 +491,7 @@ export default Ember.Component.extend({ updateInRegex(regex, filter) { const match = this.filterBlocks(regex); const inFilter = this.get("searchedTerms.special.in." + filter); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; if (inFilter) { if (match.length === 0) { @@ -528,7 +528,7 @@ export default Ember.Component.extend({ updateSearchTermForStatus() { const match = this.filterBlocks(REGEXP_STATUS_PREFIX); const statusFilter = this.get("searchedTerms.status"); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; if (statusFilter) { if (match.length !== 0) { @@ -548,7 +548,7 @@ export default Ember.Component.extend({ updateSearchTermForPostTime() { const match = this.filterBlocks(REGEXP_POST_TIME_PREFIX); const timeDaysFilter = this.get("searchedTerms.time.days"); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; if (timeDaysFilter) { const when = this.get("searchedTerms.time.when"); @@ -569,7 +569,7 @@ export default Ember.Component.extend({ updateSearchTermForMinPostCount() { const match = this.filterBlocks(REGEXP_MIN_POST_COUNT_PREFIX); const postsCountFilter = this.get("searchedTerms.min_post_count"); - let searchTerm = this.get("searchTerm") || ""; + let searchTerm = this.searchTerm || ""; if (postsCountFilter) { if (match.length !== 0) { diff --git a/app/assets/javascripts/discourse/components/search-text-field.js.es6 b/app/assets/javascripts/discourse/components/search-text-field.js.es6 index bddc31e8492..cf442f869cf 100644 --- a/app/assets/javascripts/discourse/components/search-text-field.js.es6 +++ b/app/assets/javascripts/discourse/components/search-text-field.js.es6 @@ -14,7 +14,7 @@ export default TextField.extend({ const $searchInput = this.$(); applySearchAutocomplete($searchInput, this.siteSettings); - if (!this.get("hasAutofocus")) { + if (!this.hasAutofocus) { return; } // iOS is crazy, without this we will not be diff --git a/app/assets/javascripts/discourse/components/second-factor-form.js.es6 b/app/assets/javascripts/discourse/components/second-factor-form.js.es6 index 7c75b0edc1a..f990437ce5c 100644 --- a/app/assets/javascripts/discourse/components/second-factor-form.js.es6 +++ b/app/assets/javascripts/discourse/components/second-factor-form.js.es6 @@ -31,7 +31,7 @@ export default Ember.Component.extend({ actions: { toggleSecondFactorMethod() { - const secondFactorMethod = this.get("secondFactorMethod"); + const secondFactorMethod = this.secondFactorMethod; this.set("secondFactorToken", ""); if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) { this.set("secondFactorMethod", SECOND_FACTOR_METHODS.BACKUP_CODE); diff --git a/app/assets/javascripts/discourse/components/share-panel.js.es6 b/app/assets/javascripts/discourse/components/share-panel.js.es6 index 18a48011145..872c1771bf2 100644 --- a/app/assets/javascripts/discourse/components/share-panel.js.es6 +++ b/app/assets/javascripts/discourse/components/share-panel.js.es6 @@ -40,7 +40,7 @@ export default Ember.Component.extend({ didInsertElement() { this._super(...arguments); - const shareUrl = this.get("shareUrl"); + const shareUrl = this.shareUrl; const $linkInput = this.$(".topic-share-url"); const $linkForTouch = this.$(".topic-share-url-for-touch a"); @@ -67,7 +67,7 @@ export default Ember.Component.extend({ actions: { share(source) { Sharing.shareSource(source, { - url: this.get("shareUrl"), + url: this.shareUrl, title: this.get("topic.title") }); } diff --git a/app/assets/javascripts/discourse/components/share-popup.js.es6 b/app/assets/javascripts/discourse/components/share-popup.js.es6 index d2e556f5560..fe9bd26af33 100644 --- a/app/assets/javascripts/discourse/components/share-popup.js.es6 +++ b/app/assets/javascripts/discourse/components/share-popup.js.es6 @@ -32,7 +32,7 @@ export default Ember.Component.extend({ }, _focusUrl() { - const link = this.get("link"); + const link = this.link; if (!this.capabilities.touch) { const $linkInput = $("#share-link input"); $linkInput.val(link); @@ -173,7 +173,7 @@ export default Ember.Component.extend({ share(source) { Sharing.shareSource(source, { - url: this.get("link"), + url: this.link, title: this.get("topic.title") }); } diff --git a/app/assets/javascripts/discourse/components/shared-draft-controls.js.es6 b/app/assets/javascripts/discourse/components/shared-draft-controls.js.es6 index 370a371a44d..002a13e7da9 100644 --- a/app/assets/javascripts/discourse/components/shared-draft-controls.js.es6 +++ b/app/assets/javascripts/discourse/components/shared-draft-controls.js.es6 @@ -11,7 +11,7 @@ export default Ember.Component.extend({ actions: { updateDestinationCategory(category) { - return this.get("topic").updateDestinationCategory(category.get("id")); + return this.topic.updateDestinationCategory(category.get("id")); }, publish() { @@ -19,7 +19,7 @@ export default Ember.Component.extend({ if (result) { this.set("publishing", true); let destId = this.get("topic.destination_category_id"); - this.get("topic") + this.topic .publish() .then(() => { this.set("topic.category_id", destId); diff --git a/app/assets/javascripts/discourse/components/site-header.js.es6 b/app/assets/javascripts/discourse/components/site-header.js.es6 index a49c85fa5cf..98e8dbc6ed4 100644 --- a/app/assets/javascripts/discourse/components/site-header.js.es6 +++ b/app/assets/javascripts/discourse/components/site-header.js.es6 @@ -271,7 +271,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, { buildArgs() { return { topic: this._topic, - canSignUp: this.get("canSignUp") + canSignUp: this.canSignUp }; }, diff --git a/app/assets/javascripts/discourse/components/tag-drop-link.js.es6 b/app/assets/javascripts/discourse/components/tag-drop-link.js.es6 index 099f2b8449a..ab415614298 100644 --- a/app/assets/javascripts/discourse/components/tag-drop-link.js.es6 +++ b/app/assets/javascripts/discourse/components/tag-drop-link.js.es6 @@ -27,7 +27,7 @@ export default Ember.Component.extend({ click(e) { e.preventDefault(); - DiscourseURL.routeTo(this.get("href")); + DiscourseURL.routeTo(this.href); return true; } }); diff --git a/app/assets/javascripts/discourse/components/tags-admin-dropdown.js.es6 b/app/assets/javascripts/discourse/components/tags-admin-dropdown.js.es6 index 2fc80dc6874..2a65b6705f3 100644 --- a/app/assets/javascripts/discourse/components/tags-admin-dropdown.js.es6 +++ b/app/assets/javascripts/discourse/components/tags-admin-dropdown.js.es6 @@ -40,7 +40,7 @@ export default DropdownSelectBoxComponent.extend({ actions: { onSelect(id) { - const action = this.get("actionsMapping")[id]; + const action = this.actionsMapping[id]; if (action) { action(); diff --git a/app/assets/javascripts/discourse/components/topic-list-item.js.es6 b/app/assets/javascripts/discourse/components/topic-list-item.js.es6 index 17b791fad28..8d3b139e4c0 100644 --- a/app/assets/javascripts/discourse/components/topic-list-item.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-list-item.js.es6 @@ -16,7 +16,7 @@ export function showEntrance(e) { } this.appEvents.trigger("topic-entrance:show", { - topic: this.get("topic"), + topic: this.topic, position: target.offset() }); return false; @@ -104,11 +104,11 @@ export const ListItemDefaults = { } } - if (this.get("expandGloballyPinned") && this.get("topic.pinned_globally")) { + if (this.expandGloballyPinned && this.get("topic.pinned_globally")) { return true; } - if (this.get("expandAllPinned")) { + if (this.expandAllPinned) { return true; } @@ -123,10 +123,10 @@ export const ListItemDefaults = { return result; } - const topic = this.get("topic"); + const topic = this.topic; const target = $(e.target); if (target.hasClass("bulk-select")) { - const selected = this.get("selected"); + const selected = this.selected; if (target.is(":checked")) { selected.addObject(topic); @@ -143,7 +143,7 @@ export const ListItemDefaults = { } if (target.closest("a.topic-status").length === 1) { - this.get("topic").togglePinnedForUser(); + this.topic.togglePinnedForUser(); return false; } @@ -181,7 +181,7 @@ export default Ember.Component.extend( actions: { toggleBookmark() { - this.get("topic") + this.topic .toggleBookmark() .finally(() => this.rerenderBuffer()); } diff --git a/app/assets/javascripts/discourse/components/topic-list.js.es6 b/app/assets/javascripts/discourse/components/topic-list.js.es6 index 7e370706229..44846d5b0d0 100644 --- a/app/assets/javascripts/discourse/components/topic-list.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-list.js.es6 @@ -21,12 +21,12 @@ export default Ember.Component.extend({ @computed("bulkSelectEnabled") toggleInTitle(bulkSelectEnabled) { - return !bulkSelectEnabled && this.get("canBulkSelect"); + return !bulkSelectEnabled && this.canBulkSelect; }, @computed sortable() { - return !!this.get("changeSort"); + return !!this.changeSort; }, skipHeader: Ember.computed.reads("site.mobileView"), @@ -44,7 +44,7 @@ export default Ember.Component.extend({ @observes("topics.[]") topicsAdded() { // special case so we don't keep scanning huge lists - if (!this.get("lastVisitedTopic")) { + if (!this.lastVisitedTopic) { this.refreshLastVisited(); } }, @@ -57,7 +57,7 @@ export default Ember.Component.extend({ _updateLastVisitedTopic(topics, order, ascending, top) { this.set("lastVisitedTopic", null); - if (!this.get("highlightLastVisited")) { + if (!this.highlightLastVisited) { return; } @@ -116,10 +116,10 @@ export default Ember.Component.extend({ refreshLastVisited() { this._updateLastVisitedTopic( - this.get("topics"), - this.get("order"), - this.get("ascending"), - this.get("top") + this.topics, + this.order, + this.ascending, + this.top ); }, diff --git a/app/assets/javascripts/discourse/components/topic-navigation.js.es6 b/app/assets/javascripts/discourse/components/topic-navigation.js.es6 index f2a84c4bfdb..28cf8b4ae77 100644 --- a/app/assets/javascripts/discourse/components/topic-navigation.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-navigation.js.es6 @@ -21,7 +21,7 @@ export default Ember.Component.extend(PanEvents, { return; } - let info = this.get("info"); + let info = this.info; if (info.get("topicProgressExpanded")) { info.setProperties({ @@ -35,7 +35,7 @@ export default Ember.Component.extend(PanEvents, { const width = $(window).width(); let height = $(window).height(); - if (this.get("composerOpen")) { + if (this.composerOpen) { height -= $("#reply-control").height(); } @@ -114,7 +114,7 @@ export default Ember.Component.extend(PanEvents, { modalClass: "jump-to-post-modal" }); controller.setProperties({ - topic: this.get("topic"), + topic: this.topic, jumpToIndex: this.attrs.jumpToIndex, jumpToDate: this.attrs.jumpToDate }); diff --git a/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 b/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 index 5f5a9108bd6..69235be0caf 100644 --- a/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 @@ -23,10 +23,10 @@ export default Ember.Component.extend( this.currentUser && this.currentUser.trust_level > 0 ? " " : I18n.t("filters.new.lower_title"); - const url = this.get("url"); - link(buffer, this.get("unread"), url, "unread", "unread_posts"); - link(buffer, this.get("newPosts"), url, "new-posts", "new_posts"); - link(buffer, this.get("unseen"), url, "new-topic", "new", newDotText); + const url = this.url; + link(buffer, this.unread, url, "unread", "unread_posts"); + link(buffer, this.newPosts, url, "new-posts", "new_posts"); + link(buffer, this.unseen, url, "new-topic", "new", newDotText); } }) ); diff --git a/app/assets/javascripts/discourse/components/topic-progress.js.es6 b/app/assets/javascripts/discourse/components/topic-progress.js.es6 index ff1ffaa76c5..599de61ab52 100644 --- a/app/assets/javascripts/discourse/components/topic-progress.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-progress.js.es6 @@ -76,7 +76,7 @@ export default Ember.Component.extend({ }, _topicScrolled(event) { - if (this.get("docked")) { + if (this.docked) { this.set("progressPosition", this.get("postStream.filteredPostsCount")); this._streamPercentage = 1.0; } else { @@ -97,7 +97,7 @@ export default Ember.Component.extend({ .on("topic:scrolled", this, this._dock) .on("topic:current-post-scrolled", this, this._topicScrolled); - const prevEvent = this.get("prevEvent"); + const prevEvent = this.prevEvent; if (prevEvent) { Ember.run.scheduleOnce( "afterRender", diff --git a/app/assets/javascripts/discourse/components/topic-status.js.es6 b/app/assets/javascripts/discourse/components/topic-status.js.es6 index 866ed66f879..a8dbe464a0c 100644 --- a/app/assets/javascripts/discourse/components/topic-status.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-status.js.es6 @@ -19,8 +19,8 @@ export default Ember.Component.extend( click(e) { // only pin unpin for now - if (this.get("canAct") && $(e.target).hasClass("d-icon-thumbtack")) { - const topic = this.get("topic"); + if (this.canAct && $(e.target).hasClass("d-icon-thumbtack")) { + const topic = this.topic; topic.get("pinned") ? topic.clearPin() : topic.rePin(); } @@ -33,8 +33,8 @@ export default Ember.Component.extend( }, buildBuffer(buffer) { - const canAct = this.get("canAct"); - const topic = this.get("topic"); + const canAct = this.canAct; + const topic = this.topic; if (!topic) { return; diff --git a/app/assets/javascripts/discourse/components/topic-timeline.js.es6 b/app/assets/javascripts/discourse/components/topic-timeline.js.es6 index 5f595854d39..1b0d92ca514 100644 --- a/app/assets/javascripts/discourse/components/topic-timeline.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-timeline.js.es6 @@ -13,23 +13,23 @@ export default MountWidget.extend(Docking, { buildArgs() { let attrs = { - topic: this.get("topic"), - notificationLevel: this.get("notificationLevel"), + topic: this.topic, + notificationLevel: this.notificationLevel, topicTrackingState: this.topicTrackingState, - enteredIndex: this.get("enteredIndex"), + enteredIndex: this.enteredIndex, dockAt: this.dockAt, dockBottom: this.dockBottom, mobileView: this.get("site.mobileView") }; - let event = this.get("prevEvent"); + let event = this.prevEvent; if (event) { attrs.enteredIndex = event.postIndex - 1; } - if (this.get("fullscreen")) { + if (this.fullscreen) { attrs.fullScreen = true; - attrs.addShowClass = this.get("addShowClass"); + attrs.addShowClass = this.addShowClass; } else { attrs.top = this.dockAt || headerPadding(); } @@ -85,7 +85,7 @@ export default MountWidget.extend(Docking, { didInsertElement() { this._super(...arguments); - if (this.get("fullscreen") && !this.get("addShowClass")) { + if (this.fullscreen && !this.addShowClass) { Ember.run.next(() => { this.set("addShowClass", true); this.queueRerender(); diff --git a/app/assets/javascripts/discourse/components/topic-timer-info.js.es6 b/app/assets/javascripts/discourse/components/topic-timer-info.js.es6 index fed1d14f970..5e8cdb96d35 100644 --- a/app/assets/javascripts/discourse/components/topic-timer-info.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-timer-info.js.es6 @@ -17,13 +17,13 @@ export default Ember.Component.extend( ], buildBuffer(buffer) { - if (!this.get("executeAt")) return; + if (!this.executeAt) return; - const topicStatus = this.get("topicClosed") ? "close" : "open"; - const topicStatusKnown = this.get("topicClosed") !== undefined; - if (topicStatusKnown && topicStatus === this.get("statusType")) return; + const topicStatus = this.topicClosed ? "close" : "open"; + const topicStatusKnown = this.topicClosed !== undefined; + if (topicStatusKnown && topicStatus === this.statusType) return; - let statusUpdateAt = moment(this.get("executeAt")); + let statusUpdateAt = moment(this.executeAt); let duration = moment.duration(statusUpdateAt - moment()); let minutesLeft = duration.asMinutes(); @@ -39,7 +39,7 @@ export default Ember.Component.extend( rerenderDelay = 60000; } - let autoCloseHours = this.get("duration") || 0; + let autoCloseHours = this.duration || 0; buffer.push(`${iconHTML("far-clock")} `); @@ -48,7 +48,7 @@ export default Ember.Component.extend( duration: moment.duration(autoCloseHours, "hours").humanize() }; - const categoryId = this.get("categoryId"); + const categoryId = this.categoryId; if (categoryId) { const category = Category.findById(categoryId); @@ -63,7 +63,7 @@ export default Ember.Component.extend( } buffer.push( - `${I18n.t( + `${I18n.t( this._noticeKey(), options )}` @@ -87,9 +87,9 @@ export default Ember.Component.extend( }, _noticeKey() { - const statusType = this.get("statusType"); + const statusType = this.statusType; - if (this.get("basedOnLastPost")) { + if (this.basedOnLastPost) { return `topic.status_update_notice.auto_${statusType}_based_on_last_post`; } else { return `topic.status_update_notice.auto_${statusType}`; diff --git a/app/assets/javascripts/discourse/components/track-selected.js.es6 b/app/assets/javascripts/discourse/components/track-selected.js.es6 index 7373421ebb6..bf720378b78 100644 --- a/app/assets/javascripts/discourse/components/track-selected.js.es6 +++ b/app/assets/javascripts/discourse/components/track-selected.js.es6 @@ -1,9 +1,9 @@ export default Ember.Component.extend({ tagName: "span", selectionChanged: function() { - const selected = this.get("selected"); - const list = this.get("selectedList"); - const id = this.get("selectedId"); + const selected = this.selected; + const list = this.selectedList; + const id = this.selectedId; if (selected) { list.addObject(id); diff --git a/app/assets/javascripts/discourse/components/user-card-contents.js.es6 b/app/assets/javascripts/discourse/components/user-card-contents.js.es6 index d78d1d6db2f..7fdb614e2a4 100644 --- a/app/assets/javascripts/discourse/components/user-card-contents.js.es6 +++ b/app/assets/javascripts/discourse/components/user-card-contents.js.es6 @@ -133,7 +133,7 @@ export default Ember.Component.extend( @observes("user.card_background_upload_url") addBackground() { - if (!this.get("allowBackgrounds")) { + if (!this.allowBackgrounds) { return; } @@ -188,19 +188,19 @@ export default Ember.Component.extend( }, cancelFilter() { - const postStream = this.get("postStream"); + const postStream = this.postStream; postStream.cancelFilter(); postStream.refresh(); this._close(); }, togglePosts() { - this.togglePosts(this.get("user")); + this.togglePosts(this.user); this._close(); }, deleteUser() { - this.get("user").delete(); + this.user.delete(); this._close(); }, diff --git a/app/assets/javascripts/discourse/components/user-notifications-large.js.es6 b/app/assets/javascripts/discourse/components/user-notifications-large.js.es6 index ec896cb6c86..de804fb75e1 100644 --- a/app/assets/javascripts/discourse/components/user-notifications-large.js.es6 +++ b/app/assets/javascripts/discourse/components/user-notifications-large.js.es6 @@ -6,7 +6,7 @@ export default MountWidget.extend({ init() { this._super(...arguments); - this.args = { notifications: this.get("notifications") }; + this.args = { notifications: this.notifications }; }, @observes("notifications.length", "notifications.@each.read") diff --git a/app/assets/javascripts/discourse/components/user-stream.js.es6 b/app/assets/javascripts/discourse/components/user-stream.js.es6 index 52e4b0faa91..ca24119a527 100644 --- a/app/assets/javascripts/discourse/components/user-stream.js.es6 +++ b/app/assets/javascripts/discourse/components/user-stream.js.es6 @@ -48,7 +48,7 @@ export default Ember.Component.extend(LoadMore, { actions: { removeBookmark(userAction) { - const stream = this.get("stream"); + const stream = this.stream; Post.updateBookmark(userAction.get("post_id"), false) .then(() => { stream.remove(userAction); @@ -81,7 +81,7 @@ export default Ember.Component.extend(LoadMore, { }, removeDraft(draft) { - const stream = this.get("stream"); + const stream = this.stream; Draft.clear(draft.draft_key, draft.sequence) .then(() => { stream.remove(draft); @@ -92,15 +92,15 @@ export default Ember.Component.extend(LoadMore, { }, loadMore() { - if (this.get("loading")) { + if (this.loading) { return; } this.set("loading", true); - const stream = this.get("stream"); + const stream = this.stream; stream.findItems().then(() => { this.set("loading", false); - this.get("eyeline").flushRest(); + this.eyeline.flushRest(); }); } } diff --git a/app/assets/javascripts/discourse/components/watch-read.js.es6 b/app/assets/javascripts/discourse/components/watch-read.js.es6 index 4b149d371c9..68b1d1f480f 100644 --- a/app/assets/javascripts/discourse/components/watch-read.js.es6 +++ b/app/assets/javascripts/discourse/components/watch-read.js.es6 @@ -8,7 +8,7 @@ export default Ember.Component.extend({ return; } - const path = this.get("path"); + const path = this.path; if (path === "faq" || path === "guidelines") { $(window).on("load.faq resize.faq scroll.faq", () => { const faqUnread = !currentUser.get("read_faq"); diff --git a/app/assets/javascripts/discourse/controllers/account-created-edit-email.js.es6 b/app/assets/javascripts/discourse/controllers/account-created-edit-email.js.es6 index 8c1c8503099..b22fd6de9aa 100644 --- a/app/assets/javascripts/discourse/controllers/account-created-edit-email.js.es6 +++ b/app/assets/javascripts/discourse/controllers/account-created-edit-email.js.es6 @@ -13,7 +13,7 @@ export default Ember.Controller.extend({ actions: { changeEmail() { - const email = this.get("newEmail"); + const email = this.newEmail; changeEmail({ email }) .then(() => { this.set("accountCreated.email", email); diff --git a/app/assets/javascripts/discourse/controllers/activation-edit.js.es6 b/app/assets/javascripts/discourse/controllers/activation-edit.js.es6 index e4bbedd082a..ebe73984d06 100644 --- a/app/assets/javascripts/discourse/controllers/activation-edit.js.es6 +++ b/app/assets/javascripts/discourse/controllers/activation-edit.js.es6 @@ -17,18 +17,18 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { changeEmail() { - const login = this.get("login"); + const login = this.login; changeEmail({ username: login.get("loginName"), password: login.get("loginPassword"), - email: this.get("newEmail") + email: this.newEmail }) .then(() => { const modal = this.showModal("activation-resent", { title: "log_in" }); - modal.set("currentEmail", this.get("newEmail")); + modal.set("currentEmail", this.newEmail); }) .catch(err => this.flash(extractError(err), "error")); } diff --git a/app/assets/javascripts/discourse/controllers/add-post-notice.js.es6 b/app/assets/javascripts/discourse/controllers/add-post-notice.js.es6 index 971a71a7950..d5c40b9a049 100644 --- a/app/assets/javascripts/discourse/controllers/add-post-notice.js.es6 +++ b/app/assets/javascripts/discourse/controllers/add-post-notice.js.es6 @@ -22,7 +22,7 @@ export default Ember.Controller.extend(ModalFunctionality, { }, onClose() { - const reject = this.get("reject"); + const reject = this.reject; if (reject) { reject(); } @@ -32,10 +32,10 @@ export default Ember.Controller.extend(ModalFunctionality, { setNotice() { this.set("saving", true); - const post = this.get("post"); - const resolve = this.get("resolve"); - const reject = this.get("reject"); - const notice = this.get("notice"); + const post = this.post; + const resolve = this.resolve; + const reject = this.reject; + const notice = this.notice; // Let `updatePostField` handle state. this.setProperties({ resolve: null, reject: null }); diff --git a/app/assets/javascripts/discourse/controllers/auth-token.js.es6 b/app/assets/javascripts/discourse/controllers/auth-token.js.es6 index 88ca16b4065..1d933fb1917 100644 --- a/app/assets/javascripts/discourse/controllers/auth-token.js.es6 +++ b/app/assets/javascripts/discourse/controllers/auth-token.js.es6 @@ -17,7 +17,7 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { toggleExpanded() { - this.set("expanded", !this.get("expanded")); + this.set("expanded", !this.expanded); }, highlightSecure() { diff --git a/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 b/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 index df3dbe14209..624eb3ab224 100644 --- a/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 +++ b/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 @@ -62,7 +62,7 @@ export default Ember.Controller.extend(ModalFunctionality, { } else { this.set("gravatarFailed", false); - this.get("user").setProperties({ + this.user.setProperties({ gravatar_avatar_upload_id: result.gravatar_upload_id, gravatar_avatar_template: result.gravatar_avatar_template }); @@ -72,17 +72,17 @@ export default Ember.Controller.extend(ModalFunctionality, { }, selectAvatar(url) { - this.get("user") + this.user .selectAvatar(url) .then(() => window.location.reload()) .catch(popupAjaxError); }, saveAvatarSelection() { - const selectedUploadId = this.get("selectedUploadId"); - const type = this.get("selected"); + const selectedUploadId = this.selectedUploadId; + const type = this.selected; - this.get("user") + this.user .pickAvatar(selectedUploadId, type) .then(() => window.location.reload()) .catch(popupAjaxError); diff --git a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 index 1fcda3adf7c..d3411ae6d3a 100644 --- a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 @@ -20,7 +20,7 @@ export default Ember.Controller.extend(BadgeSelectController, { @computed("username") user(username) { if (username) { - return this.get("userBadges")[0].get("user"); + return this.userBadges[0].get("user"); } }, @@ -41,16 +41,16 @@ export default Ember.Controller.extend(BadgeSelectController, { actions: { loadMore() { - if (this.get("loadingMore")) { + if (this.loadingMore) { return; } this.set("loadingMore", true); - const userBadges = this.get("userBadges"); + const userBadges = this.userBadges; UserBadge.findByBadgeId(this.get("model.id"), { offset: userBadges.length, - username: this.get("username") + username: this.username }) .then(result => { userBadges.pushObjects(result); @@ -83,6 +83,6 @@ export default Ember.Controller.extend(BadgeSelectController, { @observes("canLoadMore") _showFooter() { - this.set("application.showFooter", !this.get("canLoadMore")); + this.set("application.showFooter", !this.canLoadMore); } }); diff --git a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 b/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 index 744e28a13a4..f34195bf8a3 100644 --- a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 +++ b/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 @@ -21,9 +21,9 @@ export default Ember.Controller.extend({ actions: { changeNotificationLevel() { - this.get("topicBulkActions").performAndRefresh({ + this.topicBulkActions.performAndRefresh({ type: "change_notification_level", - notification_level_id: this.get("notificationLevelId") + notification_level_id: this.notificationLevelId }); } } diff --git a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 b/app/assets/javascripts/discourse/controllers/change-owner.js.es6 index e99aa9ee1e1..0738db87404 100644 --- a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 +++ b/app/assets/javascripts/discourse/controllers/change-owner.js.es6 @@ -38,7 +38,7 @@ export default Ember.Controller.extend(ModalFunctionality, { const options = { post_ids: this.get("topicController.selectedPostIds"), - username: this.get("new_user") + username: this.new_user }; Discourse.Topic.changeOwners( @@ -47,9 +47,9 @@ export default Ember.Controller.extend(ModalFunctionality, { ).then( () => { this.send("closeModal"); - this.get("topicController").send("deselectAll"); + this.topicController.send("deselectAll"); if (this.get("topicController.multiSelect")) { - this.get("topicController").send("toggleMultiSelect"); + this.topicController.send("toggleMultiSelect"); } Ember.run.next(() => DiscourseURL.routeTo(this.get("topicController.model.url")) diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index c6b1aba2ec7..c7ed4c474dd 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -673,7 +673,7 @@ export default Ember.Controller.extend({ }); const promise = composer - .save({ imageSizes, editReason: this.get("editReason") }) + .save({ imageSizes, editReason: this.editReason }) .then(result => { if (result.responseJson.action === "enqueued") { this.send("postWasEnqueued", result.responseJson); diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6 index c75ed35c85a..ec6d46d9aa0 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6 @@ -64,9 +64,9 @@ export default Ember.Controller.extend( "formSubmitted" ) submitDisabled() { - if (!this.get("emailValidation.failed") && !this.get("passwordRequired")) + if (!this.get("emailValidation.failed") && !this.passwordRequired) return false; // 3rd party auth - if (this.get("formSubmitted")) return true; + if (this.formSubmitted) return true; if (this.get("nameValidation.failed")) return true; if (this.get("emailValidation.failed")) return true; if (this.get("usernameValidation.failed")) return true; @@ -148,7 +148,7 @@ export default Ember.Controller.extend( @computed("accountEmail", "authOptions.email", "authOptions.email_valid") emailValidated() { return ( - this.get("authOptions.email") === this.get("accountEmail") && + this.get("authOptions.email") === this.accountEmail && this.get("authOptions.email_valid") ); }, @@ -163,17 +163,17 @@ export default Ember.Controller.extend( }, prefillUsername: function() { - if (this.get("prefilledUsername")) { + if (this.prefilledUsername) { // If username field has been filled automatically, and email field just changed, // then remove the username. - if (this.get("accountUsername") === this.get("prefilledUsername")) { + if (this.accountUsername === this.prefilledUsername) { this.set("accountUsername", ""); } this.set("prefilledUsername", null); } if ( this.get("emailValidation.ok") && - (Ember.isEmpty(this.get("accountUsername")) || + (Ember.isEmpty(this.accountUsername) || this.get("authOptions.email")) ) { // If email is valid and username has not been entered yet, @@ -204,7 +204,7 @@ export default Ember.Controller.extend( actions: { externalLogin(provider) { - this.get("login").send("externalLogin", provider); + this.login.send("externalLogin", provider); }, createAccount() { @@ -216,7 +216,7 @@ export default Ember.Controller.extend( "accountPasswordConfirm", "accountChallenge" ); - const userFields = this.get("userFields"); + const userFields = this.userFields; const destinationUrl = this.get("authOptions.destination_url"); if (!Ember.isEmpty(destinationUrl)) { @@ -262,14 +262,14 @@ export default Ember.Controller.extend( result.errors.email.length > 0 && result.values ) { - this.get("rejectedEmails").pushObject(result.values.email); + this.rejectedEmails.pushObject(result.values.email); } if ( result.errors && result.errors.password && result.errors.password.length > 0 ) { - this.get("rejectedPasswords").pushObject(attrs.accountPassword); + this.rejectedPasswords.pushObject(attrs.accountPassword); } this.set("formSubmitted", false); $.removeCookie("destination_url"); diff --git a/app/assets/javascripts/discourse/controllers/discovery.js.es6 b/app/assets/javascripts/discourse/controllers/discovery.js.es6 index c19e0f7fb1b..858058e4b09 100644 --- a/app/assets/javascripts/discourse/controllers/discovery.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery.js.es6 @@ -13,17 +13,17 @@ export default Ember.Controller.extend({ loadedAllItems: Ember.computed.not("discoveryTopics.model.canLoadMore"), _showFooter: function() { - this.set("application.showFooter", this.get("loadedAllItems")); + this.set("application.showFooter", this.loadedAllItems); }.observes("loadedAllItems"), showMoreUrl(period) { let url = "", - category = this.get("category"); + category = this.category; if (category) { url = "/c/" + Discourse.Category.slugFor(category) + - (this.get("noSubcategories") ? "/none" : "") + + (this.noSubcategories ? "/none" : "") + "/l"; } url += "/top/" + period; diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index 6cbce872192..c6443bd37e8 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -33,13 +33,13 @@ const controllerOpts = { actions: { changeSort(sortBy) { - if (sortBy === this.get("order")) { + if (sortBy === this.order) { this.toggleProperty("ascending"); } else { this.setProperties({ order: sortBy, ascending: false }); } - this.get("model").refreshSort(sortBy, this.get("ascending")); + this.model.refreshSort(sortBy, this.ascending); }, // Show newly inserted topics @@ -47,7 +47,7 @@ const controllerOpts = { const tracker = this.topicTrackingState; // Move inserted into topics - this.get("model").loadBefore(tracker.get("newIncoming"), true); + this.model.loadBefore(tracker.get("newIncoming"), true); tracker.resetTracking(); return false; }, @@ -68,7 +68,7 @@ const controllerOpts = { this.topicTrackingState.resetTracking(); this.store.findFiltered("topicList", { filter }).then(list => { - TopicList.hideUniformCategory(list, this.get("category")); + TopicList.hideUniformCategory(list, this.category); this.setProperties({ model: list }); this.resetSelected(); @@ -132,7 +132,7 @@ const controllerOpts = { footerMessage(allLoaded, topicsLength) { if (!allLoaded) return; - const category = this.get("category"); + const category = this.category; if (category) { return I18n.t("topics.bottom.category", { category: category.get("name") diff --git a/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 b/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 index b710c5feb5d..781229ed638 100644 --- a/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 @@ -76,7 +76,7 @@ export default Ember.Controller.extend(ModalFunctionality, { if (time) { this.send("closeModal"); - Ember.setProperties(this.get("topicTimer"), { + Ember.setProperties(this.topicTimer, { execute_at: result.execute_at, duration: result.duration, category_id: result.category_id @@ -85,7 +85,7 @@ export default Ember.Controller.extend(ModalFunctionality, { this.set("model.closed", result.closed); } else { const topicTimer = - this.get("isPublic") === "true" + this.isPublic === "true" ? "topic_timer" : "private_topic_timer"; this.set(`model.${topicTimer}`, Ember.Object.create({})); diff --git a/app/assets/javascripts/discourse/controllers/exception.js.es6 b/app/assets/javascripts/discourse/controllers/exception.js.es6 index 0009df44ed7..6a45998e5a1 100644 --- a/app/assets/javascripts/discourse/controllers/exception.js.es6 +++ b/app/assets/javascripts/discourse/controllers/exception.js.es6 @@ -53,13 +53,13 @@ export default Ember.Controller.extend({ @computed("isNetwork", "isServer", "isUnknown") reason() { - if (this.get("isNetwork")) { + if (this.isNetwork) { return I18n.t("errors.reasons.network"); - } else if (this.get("isServer")) { + } else if (this.isServer) { return I18n.t("errors.reasons.server"); - } else if (this.get("isNotFound")) { + } else if (this.isNotFound) { return I18n.t("errors.reasons.not_found"); - } else if (this.get("isForbidden")) { + } else if (this.isForbidden) { return I18n.t("errors.reasons.forbidden"); } else { // TODO @@ -71,13 +71,13 @@ export default Ember.Controller.extend({ @computed("networkFixed", "isNetwork", "isServer", "isUnknown") desc() { - if (this.get("networkFixed")) { + if (this.networkFixed) { return I18n.t("errors.desc.network_fixed"); - } else if (this.get("isNetwork")) { + } else if (this.isNetwork) { return I18n.t("errors.desc.network"); - } else if (this.get("isNotFound")) { + } else if (this.isNotFound) { return I18n.t("errors.desc.not_found"); - } else if (this.get("isServer")) { + } else if (this.isServer) { return I18n.t("errors.desc.server", { status: this.get("thrown.status") + " " + this.get("thrown.statusText") }); @@ -89,9 +89,9 @@ export default Ember.Controller.extend({ @computed("networkFixed", "isNetwork", "isServer", "isUnknown") enabledButtons() { - if (this.get("networkFixed")) { + if (this.networkFixed) { return [ButtonLoadPage]; - } else if (this.get("isNetwork")) { + } else if (this.isNetwork) { return [ButtonBackDim, ButtonTryAgain]; } else { return [ButtonBackBright, ButtonTryAgain]; diff --git a/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 b/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 index ebc003665b1..9709b21c48a 100644 --- a/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 @@ -117,7 +117,7 @@ export default Ember.Controller.extend(ModalFunctionality, { }, _forwardAction(name) { - this.get("topicController").send(name); + this.topicController.send(name); this.send("closeModal"); }, @@ -138,7 +138,7 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { pin() { - if (this.get("pinDisabled")) { + if (this.pinDisabled) { this.set("pinInCategoryTipShownAt", Date.now()); } else { this._forwardAction("togglePinned"); @@ -146,11 +146,11 @@ export default Ember.Controller.extend(ModalFunctionality, { }, pinGlobally() { - if (this.get("pinGloballyDisabled")) { + if (this.pinGloballyDisabled) { this.set("pinGloballyTipShownAt", Date.now()); } else { this._confirmBeforePinning( - this.get("pinnedGloballyCount"), + this.pinnedGloballyCount, "pin_globally", "pinGlobally" ); diff --git a/app/assets/javascripts/discourse/controllers/flag.js.es6 b/app/assets/javascripts/discourse/controllers/flag.js.es6 index 88719741176..bcfbb5e325c 100644 --- a/app/assets/javascripts/discourse/controllers/flag.js.es6 +++ b/app/assets/javascripts/discourse/controllers/flag.js.es6 @@ -21,7 +21,7 @@ export default Ember.Controller.extend(ModalFunctionality, { spammerDetails: null }); - let adminTools = this.get("adminTools"); + let adminTools = this.adminTools; if (adminTools) { adminTools.checkSpammer(this.get("model.user_id")).then(result => { this.set("spammerDetails", result); @@ -41,7 +41,7 @@ export default Ember.Controller.extend(ModalFunctionality, { @computed("post", "flagTopic", "model.actions_summary.@each.can_act") flagsAvailable() { - if (!this.get("flagTopic")) { + if (!this.flagTopic) { // flagging post let flagsAvailable = this.get("model.flagsAvailable"); @@ -58,7 +58,7 @@ export default Ember.Controller.extend(ModalFunctionality, { } else { // flagging topic let lookup = Ember.Object.create(); - let model = this.get("model"); + let model = this.model; model.get("actions_summary").forEach(a => { a.flagTopic = model; a.actionType = this.site.topicFlagTypeById(a.id); @@ -84,7 +84,7 @@ export default Ember.Controller.extend(ModalFunctionality, { @computed("selected.is_custom_flag", "message.length") submitEnabled() { - const selected = this.get("selected"); + const selected = this.selected; if (!selected) return false; if (selected.get("is_custom_flag")) { @@ -122,7 +122,7 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { deleteSpammer() { - let details = this.get("spammerDetails"); + let details = this.spammerDetails; if (details) { details.deleteUser().then(() => window.location.reload()); } @@ -136,7 +136,7 @@ export default Ember.Controller.extend(ModalFunctionality, { createFlag(opts) { let postAction; // an instance of ActionSummary - if (!this.get("flagTopic")) { + if (!this.flagTopic) { postAction = this.get("model.actions_summary").findBy( "id", this.get("selected.id") @@ -148,7 +148,7 @@ export default Ember.Controller.extend(ModalFunctionality, { } let params = this.get("selected.is_custom_flag") - ? { message: this.get("message") } + ? { message: this.message } : {}; if (opts) { params = $.extend(params, opts); @@ -157,7 +157,7 @@ export default Ember.Controller.extend(ModalFunctionality, { this.send("hideModal"); postAction - .act(this.get("model"), params) + .act(this.model, params) .then(() => { this.send("closeModal"); if (params.message) { diff --git a/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 b/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 index 127acb0bcb7..288ffa8ba87 100644 --- a/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 +++ b/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 @@ -34,18 +34,18 @@ export default Ember.Controller.extend(ModalFunctionality, { }, resetPassword() { - if (this.get("submitDisabled")) return false; + if (this.submitDisabled) return false; this.set("disabled", true); this.clearFlash(); ajax("/session/forgot_password", { - data: { login: this.get("accountEmailOrUsername").trim() }, + data: { login: this.accountEmailOrUsername.trim() }, type: "POST" }) .then(data => { const accountEmailOrUsername = escapeExpression( - this.get("accountEmailOrUsername") + this.accountEmailOrUsername ); const isEmail = accountEmailOrUsername.match(/@/); let key = `forgot_password.complete_${ diff --git a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 index 9ede0a73460..03bd572782e 100644 --- a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 +++ b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 @@ -137,8 +137,8 @@ export default Ember.Controller.extend({ @observes("model") modelChanged() { - if (this.get("searchTerm") !== this.get("q")) { - this.setSearchTerm(this.get("q")); + if (this.searchTerm !== this.q) { + this.setSearchTerm(this.q); } }, @@ -149,9 +149,9 @@ export default Ember.Controller.extend({ @observes("q") qChanged() { - const model = this.get("model"); - if (model && this.get("model.q") !== this.get("q")) { - this.setSearchTerm(this.get("q")); + const model = this.model; + if (model && this.get("model.q") !== this.q) { + this.setSearchTerm(this.q); this.send("search"); } }, @@ -170,7 +170,7 @@ export default Ember.Controller.extend({ @observes("loading") _showFooter() { - this.set("application.showFooter", !this.get("loading")); + this.set("application.showFooter", !this.loading); }, @computed("resultCount", "noSortQ") @@ -207,39 +207,39 @@ export default Ember.Controller.extend({ searchButtonDisabled: Ember.computed.or("searching", "loading"), _search() { - if (this.get("searching")) { + if (this.searching) { return; } this.set("invalidSearch", false); - const searchTerm = this.get("searchTerm"); + const searchTerm = this.searchTerm; if (!isValidSearchTerm(searchTerm)) { this.set("invalidSearch", true); return; } - let args = { q: searchTerm, page: this.get("page") }; + let args = { q: searchTerm, page: this.page }; if (args.page === 1) { this.set("bulkSelectEnabled", false); - this.get("selected").clear(); + this.selected.clear(); this.set("searching", true); } else { this.set("loading", true); } - const sortOrder = this.get("sortOrder"); + const sortOrder = this.sortOrder; if (sortOrder && SortOrders[sortOrder].term) { args.q += " " + SortOrders[sortOrder].term; } this.set("q", args.q); - const skip = this.get("skip_context"); - if ((!skip && this.get("context")) || skip === "false") { + const skip = this.skip_context; + if ((!skip && this.context) || skip === "false") { args.search_context = { - type: this.get("context"), - id: this.get("context_id") + type: this.context, + id: this.context_id }; } @@ -255,9 +255,9 @@ export default Ember.Controller.extend({ if (args.page > 1) { if (model) { - this.get("model").posts.pushObjects(model.posts); - this.get("model").topics.pushObjects(model.topics); - this.get("model").set( + this.model.posts.pushObjects(model.posts); + this.model.topics.pushObjects(model.topics); + this.model.set( "grouped_search_result", results.grouped_search_result ); @@ -283,7 +283,7 @@ export default Ember.Controller.extend({ topicCategory = match[1]; } } - this.get("composer").open({ + this.composer.open({ action: Composer.CREATE_TOPIC, draftKey: Composer.CREATE_TOPIC, topicCategory @@ -291,7 +291,7 @@ export default Ember.Controller.extend({ }, selectAll() { - this.get("selected").addObjects( + this.selected.addObjects( this.get("model.posts").map(r => r.topic) ); // Doing this the proper way is a HUGE pain, @@ -303,13 +303,13 @@ export default Ember.Controller.extend({ }, clearAll() { - this.get("selected").clear(); + this.selected.clear(); $(".fps-result input[type=checkbox]").prop("checked", false); }, toggleBulkSelect() { this.toggleProperty("bulkSelectEnabled"); - this.get("selected").clear(); + this.selected.clear(); }, search() { @@ -323,10 +323,10 @@ export default Ember.Controller.extend({ }, loadMore() { - var page = this.get("page"); + var page = this.page; if ( this.get("model.grouped_search_result.more_full_page_results") && - !this.get("loading") && + !this.loading && page < PAGE_LIMIT ) { this.incrementProperty("page"); diff --git a/app/assets/javascripts/discourse/controllers/grant-badge.js.es6 b/app/assets/javascripts/discourse/controllers/grant-badge.js.es6 index fcd22bb04d3..a3089dfc8a8 100644 --- a/app/assets/javascripts/discourse/controllers/grant-badge.js.es6 +++ b/app/assets/javascripts/discourse/controllers/grant-badge.js.es6 @@ -55,9 +55,9 @@ export default Ember.Controller.extend( this.set("saving", true); this.grantBadge( - this.get("selectedBadgeId"), + this.selectedBadgeId, this.get("post.username"), - this.get("badgeReason") + this.badgeReason ) .then( newBadge => { diff --git a/app/assets/javascripts/discourse/controllers/group-activity-posts.js.es6 b/app/assets/javascripts/discourse/controllers/group-activity-posts.js.es6 index 3630d837023..3e4454ce0ee 100644 --- a/app/assets/javascripts/discourse/controllers/group-activity-posts.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-activity-posts.js.es6 @@ -11,20 +11,20 @@ export default Ember.Controller.extend({ actions: { loadMore() { - if (!this.get("canLoadMore")) { + if (!this.canLoadMore) { return; } - if (this.get("loading")) { + if (this.loading) { return; } this.set("loading", true); - const posts = this.get("model"); + const posts = this.model; if (posts && posts.length) { const beforePostId = posts[posts.length - 1].get("id"); const group = this.get("group.model"); let categoryId = this.get("groupActivity.category_id"); - const opts = { beforePostId, type: this.get("type"), categoryId }; + const opts = { beforePostId, type: this.type, categoryId }; group .findPosts(opts) @@ -43,6 +43,6 @@ export default Ember.Controller.extend({ @observes("canLoadMore") _showFooter() { - this.set("application.showFooter", !this.get("canLoadMore")); + this.set("application.showFooter", !this.canLoadMore); } }); diff --git a/app/assets/javascripts/discourse/controllers/group-activity-topics.js.es6 b/app/assets/javascripts/discourse/controllers/group-activity-topics.js.es6 index 7f7df2a1a61..2a559a196c1 100644 --- a/app/assets/javascripts/discourse/controllers/group-activity-topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-activity-topics.js.es6 @@ -1,7 +1,7 @@ export default Ember.Controller.extend({ actions: { loadMore() { - this.get("model").loadMore(); + this.model.loadMore(); } } }); diff --git a/app/assets/javascripts/discourse/controllers/group-add-members.js.es6 b/app/assets/javascripts/discourse/controllers/group-add-members.js.es6 index 6c46b360e3d..6e478fe3d86 100644 --- a/app/assets/javascripts/discourse/controllers/group-add-members.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-add-members.js.es6 @@ -15,14 +15,14 @@ export default Ember.Controller.extend(ModalFunctionality, { addMembers() { this.set("loading", true); - const model = this.get("model"); + const model = this.model; const usernames = model.get("usernames"); if (Ember.isEmpty(usernames)) { return; } let promise; - if (this.get("setAsOwner")) { + if (this.setAsOwner) { promise = model.addOwners(usernames, true); } else { promise = model.addMembers(usernames, true); diff --git a/app/assets/javascripts/discourse/controllers/group-bulk-add.js.es6 b/app/assets/javascripts/discourse/controllers/group-bulk-add.js.es6 index 9c51b2de422..716347d4c6b 100644 --- a/app/assets/javascripts/discourse/controllers/group-bulk-add.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-bulk-add.js.es6 @@ -22,7 +22,7 @@ export default Ember.Controller.extend(ModalFunctionality, { result: null }); - const users = this.get("input") + const users = this.input .split("\n") .uniq() .reject(x => x.length === 0); diff --git a/app/assets/javascripts/discourse/controllers/group-index.js.es6 b/app/assets/javascripts/discourse/controllers/group-index.js.es6 index 1b9eeb68aa4..0018563b0d6 100644 --- a/app/assets/javascripts/discourse/controllers/group-index.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-index.js.es6 @@ -21,16 +21,16 @@ export default Ember.Controller.extend({ @observes("filterInput") _setFilter: debounce(function() { - this.set("filter", this.get("filterInput")); + this.set("filter", this.filterInput); }, 500), @observes("order", "desc", "filter") refreshMembers() { this.set("loading", true); - const model = this.get("model"); + const model = this.model; if (model) { - model.findMembers(this.get("memberParams")).finally(() => { + model.findMembers(this.memberParams).finally(() => { this.set( "application.showFooter", model.members.length >= model.user_count @@ -70,21 +70,21 @@ export default Ember.Controller.extend({ }, removeMember(user) { - this.get("model").removeMember(user, this.get("memberParams")); + this.model.removeMember(user, this.memberParams); }, makeOwner(username) { - this.get("model").addOwners(username); + this.model.addOwners(username); }, removeOwner(user) { - this.get("model").removeOwner(user); + this.model.removeOwner(user); }, addMembers() { - const usernames = this.get("usernames"); + const usernames = this.usernames; if (usernames && usernames.length > 0) { - this.get("model") + this.model .addMembers(usernames) .then(() => this.set("usernames", [])) .catch(popupAjaxError); @@ -92,7 +92,7 @@ export default Ember.Controller.extend({ }, loadMore() { - if (this.get("loading")) { + if (this.loading) { return; } if (this.get("model.members.length") >= this.get("model.user_count")) { @@ -105,8 +105,8 @@ export default Ember.Controller.extend({ Group.loadMembers( this.get("model.name"), this.get("model.members.length"), - this.get("limit"), - { order: this.get("order"), desc: this.get("desc") } + this.limit, + { order: this.order, desc: this.desc } ).then(result => { this.get("model.members").addObjects( result.members.map(member => Discourse.User.create(member)) diff --git a/app/assets/javascripts/discourse/controllers/group-manage-logs.js.es6 b/app/assets/javascripts/discourse/controllers/group-manage-logs.js.es6 index 5f301f38716..22ee01cff5e 100644 --- a/app/assets/javascripts/discourse/controllers/group-manage-logs.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-manage-logs.js.es6 @@ -32,11 +32,11 @@ export default Ember.Controller.extend({ ) _refreshModel() { this.get("group.model") - .findLogs(0, this.get("filterParams")) + .findLogs(0, this.filterParams) .then(results => { this.set("offset", 0); - this.get("model").setProperties({ + this.model.setProperties({ logs: results.logs, all_loaded: results.all_loaded }); @@ -62,7 +62,7 @@ export default Ember.Controller.extend({ this.set("loading", true); this.get("group.model") - .findLogs(this.get("offset") + 1, this.get("filterParams")) + .findLogs(this.offset + 1, this.filterParams) .then(results => { results.logs.forEach(result => this.get("model.logs").addObject(result) diff --git a/app/assets/javascripts/discourse/controllers/group-requests.js.es6 b/app/assets/javascripts/discourse/controllers/group-requests.js.es6 index ed07261f384..178db757588 100644 --- a/app/assets/javascripts/discourse/controllers/group-requests.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-requests.js.es6 @@ -20,19 +20,19 @@ export default Ember.Controller.extend({ @observes("filterInput") _setFilter: debounce(function() { - this.set("filter", this.get("filterInput")); + this.set("filter", this.filterInput); }, 500), @observes("order", "desc", "filter") refreshRequesters(force) { - if (this.get("loading") || !this.get("model")) { + if (this.loading || !this.model) { return; } if ( !force && - this.get("count") && - this.get("model.requesters.length") >= this.get("count") + this.count && + this.get("model.requesters.length") >= this.count ) { this.set("application.showFooter", true); return; @@ -44,11 +44,11 @@ export default Ember.Controller.extend({ Group.loadMembers( this.get("model.name"), force ? 0 : this.get("model.requesters.length"), - this.get("limit"), + this.limit, { - order: this.get("order"), - desc: this.get("desc"), - filter: this.get("filter"), + order: this.order, + desc: this.desc, + filter: this.filter, requesters: true } ).then(result => { diff --git a/app/assets/javascripts/discourse/controllers/group.js.es6 b/app/assets/javascripts/discourse/controllers/group.js.es6 index 81302d755c4..f6a44552aa7 100644 --- a/app/assets/javascripts/discourse/controllers/group.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group.js.es6 @@ -3,9 +3,9 @@ import { default as computed } from "ember-addons/ember-computed-decorators"; const Tab = Ember.Object.extend({ init() { this._super(...arguments); - let name = this.get("name"); - this.set("route", this.get("route") || `group.` + name); - this.set("message", I18n.t(`groups.${this.get("i18nKey") || name}`)); + let name = this.name; + this.set("route", this.route || `group.` + name); + this.set("message", I18n.t(`groups.${this.i18nKey || name}`)); } }); @@ -119,7 +119,7 @@ export default Ember.Controller.extend({ }, destroy() { - const group = this.get("model"); + const group = this.model; this.set("destroying", true); bootbox.confirm( diff --git a/app/assets/javascripts/discourse/controllers/groups-index.js.es6 b/app/assets/javascripts/discourse/controllers/groups-index.js.es6 index f00e7ed6dc7..1c6a824deda 100644 --- a/app/assets/javascripts/discourse/controllers/groups-index.js.es6 +++ b/app/assets/javascripts/discourse/controllers/groups-index.js.es6 @@ -27,7 +27,7 @@ export default Ember.Controller.extend({ @observes("filterInput") _setFilter: debounce(function() { - this.set("filter", this.get("filterInput")); + this.set("filter", this.filterInput); }, 500), @observes("model.canLoadMore") @@ -37,7 +37,7 @@ export default Ember.Controller.extend({ actions: { loadMore() { - this.get("model").loadMore(); + this.model.loadMore(); }, new() { diff --git a/app/assets/javascripts/discourse/controllers/groups-new.js.es6 b/app/assets/javascripts/discourse/controllers/groups-new.js.es6 index c73c6625e52..293beffd532 100644 --- a/app/assets/javascripts/discourse/controllers/groups-new.js.es6 +++ b/app/assets/javascripts/discourse/controllers/groups-new.js.es6 @@ -6,7 +6,7 @@ export default Ember.Controller.extend({ actions: { save() { this.set("saving", true); - const group = this.get("model"); + const group = this.model; group .create() diff --git a/app/assets/javascripts/discourse/controllers/history.js.es6 b/app/assets/javascripts/discourse/controllers/history.js.es6 index cea58e426ef..d1d5c45f733 100644 --- a/app/assets/javascripts/discourse/controllers/history.js.es6 +++ b/app/assets/javascripts/discourse/controllers/history.js.es6 @@ -180,7 +180,7 @@ export default Ember.Controller.extend(ModalFunctionality, { @computed("model.previous_hidden", "model.current_hidden", "displayingInline") hiddenClasses(prevHidden, currentHidden, displayingInline) { if (displayingInline) { - return this.get("isEitherRevisionHidden") + return this.isEitherRevisionHidden ? "hidden-revision-either" : null; } else { @@ -256,7 +256,7 @@ export default Ember.Controller.extend(ModalFunctionality, { @observes("viewMode", "model.body_changes") bodyDiffChanged() { - const viewMode = this.get("viewMode"); + const viewMode = this.viewMode; const html = this.get(`model.body_changes.${viewMode}`); if (viewMode === "side_by_side_markdown") { this.set("bodyDiff", html); @@ -299,12 +299,12 @@ export default Ember.Controller.extend(ModalFunctionality, { }, editPost() { - this.get("topicController").send("editPost", this.get("post")); + this.topicController.send("editPost", this.post); this.send("closeModal"); }, revertToVersion() { - this.revert(this.get("post"), this.get("model.current_revision")); + this.revert(this.post, this.get("model.current_revision")); }, displayInline() { diff --git a/app/assets/javascripts/discourse/controllers/ignore-duration-with-username.js.es6 b/app/assets/javascripts/discourse/controllers/ignore-duration-with-username.js.es6 index fc1f8ce58de..6ba026a1b87 100644 --- a/app/assets/javascripts/discourse/controllers/ignore-duration-with-username.js.es6 +++ b/app/assets/javascripts/discourse/controllers/ignore-duration-with-username.js.es6 @@ -8,7 +8,7 @@ export default Ember.Controller.extend(ModalFunctionality, { ignoredUsername: null, actions: { ignore() { - if (!this.get("ignoredUntil") || !this.get("ignoredUsername")) { + if (!this.ignoredUntil || !this.ignoredUsername) { this.flash( I18n.t("user.user_notifications.ignore_duration_time_frame_required"), "alert-error" @@ -16,11 +16,11 @@ export default Ember.Controller.extend(ModalFunctionality, { return; } this.set("loading", true); - User.findByUsername(this.get("ignoredUsername")).then(user => { + User.findByUsername(this.ignoredUsername).then(user => { user - .updateNotificationLevel("ignore", this.get("ignoredUntil")) + .updateNotificationLevel("ignore", this.ignoredUntil) .then(() => { - this.onUserIgnored(this.get("ignoredUsername")); + this.onUserIgnored(this.ignoredUsername); this.send("closeModal"); }) .catch(popupAjaxError) diff --git a/app/assets/javascripts/discourse/controllers/ignore-duration.js.es6 b/app/assets/javascripts/discourse/controllers/ignore-duration.js.es6 index e734e7764b2..574f69e3739 100644 --- a/app/assets/javascripts/discourse/controllers/ignore-duration.js.es6 +++ b/app/assets/javascripts/discourse/controllers/ignore-duration.js.es6 @@ -6,7 +6,7 @@ export default Ember.Controller.extend(ModalFunctionality, { ignoredUntil: null, actions: { ignore() { - if (!this.get("ignoredUntil")) { + if (!this.ignoredUntil) { this.flash( I18n.t("user.user_notifications.ignore_duration_time_frame_required"), "alert-error" @@ -14,13 +14,13 @@ export default Ember.Controller.extend(ModalFunctionality, { return; } this.set("loading", true); - this.get("model") - .updateNotificationLevel("ignore", this.get("ignoredUntil")) + this.model + .updateNotificationLevel("ignore", this.ignoredUntil) .then(() => { this.set("model.ignored", true); this.set("model.muted", false); - if (this.get("onSuccess")) { - this.get("onSuccess")(); + if (this.onSuccess) { + this.onSuccess(); } this.send("closeModal"); }) diff --git a/app/assets/javascripts/discourse/controllers/invites-show.js.es6 b/app/assets/javascripts/discourse/controllers/invites-show.js.es6 index 2182b88e13e..463549851fb 100644 --- a/app/assets/javascripts/discourse/controllers/invites-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invites-show.js.es6 @@ -64,7 +64,7 @@ export default Ember.Controller.extend( actions: { submit() { - const userFields = this.get("userFields"); + const userFields = this.userFields; let userCustomFields = {}; if (!Ember.isEmpty(userFields)) { userFields.forEach(function(f) { @@ -76,9 +76,9 @@ export default Ember.Controller.extend( url: `/invites/show/${this.get("model.token")}.json`, type: "PUT", data: { - username: this.get("accountUsername"), - name: this.get("accountName"), - password: this.get("accountPassword"), + username: this.accountUsername, + name: this.accountName, + password: this.accountPassword, user_custom_fields: userCustomFields } }) @@ -97,11 +97,11 @@ export default Ember.Controller.extend( result.errors.password && result.errors.password.length > 0 ) { - this.get("rejectedPasswords").pushObject( - this.get("accountPassword") + this.rejectedPasswords.pushObject( + this.accountPassword ); - this.get("rejectedPasswordsMessages").set( - this.get("accountPassword"), + this.rejectedPasswordsMessages.set( + this.accountPassword, result.errors.password[0] ); } diff --git a/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 b/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 index bddaa746c7c..e5cabd5b28f 100644 --- a/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 +++ b/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 @@ -14,13 +14,13 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { jump() { - if (this.get("postNumber")) { + if (this.postNumber) { this._jumpToIndex( - this.get("filteredPostsCount"), - this.get("postNumber") + this.filteredPostsCount, + this.postNumber ); - } else if (this.get("postDate")) { - this._jumpToDate(this.get("postDate")); + } else if (this.postDate) { + this._jumpToDate(this.postDate); } } }, diff --git a/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 b/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 index ce56fa15fee..3652ca1c038 100644 --- a/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 @@ -69,9 +69,9 @@ export default Ember.Controller.extend(ModalFunctionality, { if (isPrivateMessage) { this.set( "selection", - this.get("canSplitToPM") ? "new_message" : "existing_message" + this.canSplitToPM ? "new_message" : "existing_message" ); - } else if (!this.get("canSplitTopic")) { + } else if (!this.canSplitTopic) { this.set("selection", "existing_topic"); Ember.run.next(() => $("#choose-topic-title").focus()); } @@ -94,7 +94,7 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { performMove() { - this.get("moveTypes").forEach(type => { + this.moveTypes.forEach(type => { if (this.get(type)) { this.send("movePostsTo", type); } @@ -107,15 +107,15 @@ export default Ember.Controller.extend(ModalFunctionality, { let mergeOptions, moveOptions; if (type === "existingTopic") { - mergeOptions = { destination_topic_id: this.get("selectedTopicId") }; + mergeOptions = { destination_topic_id: this.selectedTopicId }; moveOptions = Object.assign( { post_ids: this.get("topicController.selectedPostIds") }, mergeOptions ); } else if (type === "existingMessage") { mergeOptions = { - destination_topic_id: this.get("selectedTopicId"), - participants: this.get("participants"), + destination_topic_id: this.selectedTopicId, + participants: this.participants, archetype: "private_message" }; moveOptions = Object.assign( @@ -125,17 +125,17 @@ export default Ember.Controller.extend(ModalFunctionality, { } else if (type === "newTopic") { mergeOptions = {}; moveOptions = { - title: this.get("topicName"), + title: this.topicName, post_ids: this.get("topicController.selectedPostIds"), - category_id: this.get("categoryId"), - tags: this.get("tags") + category_id: this.categoryId, + tags: this.tags }; } else { mergeOptions = {}; moveOptions = { - title: this.get("topicName"), + title: this.topicName, post_ids: this.get("topicController.selectedPostIds"), - tags: this.get("tags"), + tags: this.tags, archetype: "private_message" }; } @@ -147,7 +147,7 @@ export default Ember.Controller.extend(ModalFunctionality, { promise .then(result => { this.send("closeModal"); - this.get("topicController").send("toggleMultiSelect"); + this.topicController.send("toggleMultiSelect"); DiscourseURL.routeTo(result.url); }) .catch(xhr => { diff --git a/app/assets/javascripts/discourse/controllers/not-activated.js.es6 b/app/assets/javascripts/discourse/controllers/not-activated.js.es6 index 8343e9c3bd2..71824b3e150 100644 --- a/app/assets/javascripts/discourse/controllers/not-activated.js.es6 +++ b/app/assets/javascripts/discourse/controllers/not-activated.js.es6 @@ -4,9 +4,9 @@ import { resendActivationEmail } from "discourse/lib/user-activation"; export default Ember.Controller.extend(ModalFunctionality, { actions: { sendActivationEmail() { - resendActivationEmail(this.get("username")).then(() => { + resendActivationEmail(this.username).then(() => { const modal = this.showModal("activation-resent", { title: "log_in" }); - modal.set("currentEmail", this.get("currentEmail")); + modal.set("currentEmail", this.currentEmail); }); }, @@ -15,7 +15,7 @@ export default Ember.Controller.extend(ModalFunctionality, { title: "login.change_email" }); - const currentEmail = this.get("currentEmail"); + const currentEmail = this.currentEmail; modal.set("currentEmail", currentEmail); modal.set("newEmail", currentEmail); } diff --git a/app/assets/javascripts/discourse/controllers/password-reset.js.es6 b/app/assets/javascripts/discourse/controllers/password-reset.js.es6 index 2c74c8f2086..2bfbe588d20 100644 --- a/app/assets/javascripts/discourse/controllers/password-reset.js.es6 +++ b/app/assets/javascripts/discourse/controllers/password-reset.js.es6 @@ -37,9 +37,9 @@ export default Ember.Controller.extend(PasswordValidation, { url: userPath(`password-reset/${this.get("model.token")}.json`), type: "PUT", data: { - password: this.get("accountPassword"), - second_factor_token: this.get("secondFactorToken"), - second_factor_method: this.get("secondFactorMethod") + password: this.accountPassword, + second_factor_token: this.secondFactorToken, + second_factor_method: this.secondFactorMethod } }) .then(result => { @@ -59,7 +59,7 @@ export default Ember.Controller.extend(PasswordValidation, { password: null, errorMessage: result.message }); - } else if (this.get("secondFactorRequired")) { + } else if (this.secondFactorRequired) { this.setProperties({ secondFactorRequired: false, errorMessage: null @@ -69,11 +69,11 @@ export default Ember.Controller.extend(PasswordValidation, { result.errors.password && result.errors.password.length > 0 ) { - this.get("rejectedPasswords").pushObject( - this.get("accountPassword") + this.rejectedPasswords.pushObject( + this.accountPassword ); - this.get("rejectedPasswordsMessages").set( - this.get("accountPassword"), + this.rejectedPasswordsMessages.set( + this.accountPassword, result.errors.password[0] ); } @@ -94,7 +94,7 @@ export default Ember.Controller.extend(PasswordValidation, { done() { this.set("redirected", true); - DiscourseURL.redirectTo(this.get("redirectTo") || "/"); + DiscourseURL.redirectTo(this.redirectTo || "/"); } } }); diff --git a/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 index 303e38ed65e..7c10170df61 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 @@ -134,13 +134,13 @@ export default Ember.Controller.extend( save() { this.set("saved", false); - const model = this.get("model"); + const model = this.model; - model.set("name", this.get("newNameInput")); - model.set("title", this.get("newTitleInput")); + model.set("name", this.newNameInput); + model.set("title", this.newTitleInput); return model - .save(this.get("saveAttrNames")) + .save(this.saveAttrNames) .then(() => { this.set("saved", true); }) @@ -148,12 +148,12 @@ export default Ember.Controller.extend( }, changePassword() { - if (!this.get("passwordProgress")) { + if (!this.passwordProgress) { this.set( "passwordProgress", I18n.t("user.change_password.in_progress") ); - return this.get("model") + return this.model .changePassword() .then(() => { // password changed @@ -176,7 +176,7 @@ export default Ember.Controller.extend( this.set("deleting", true); const self = this, message = I18n.t("user.delete_account_confirm"), - model = this.get("model"), + model = this.model, buttons = [ { label: I18n.t("cancel"), @@ -210,7 +210,7 @@ export default Ember.Controller.extend( }, revokeAccount(account) { - const model = this.get("model"); + const model = this.model; this.set("revoking", true); model .revokeAssociatedAccount(account.name) @@ -228,7 +228,7 @@ export default Ember.Controller.extend( }, toggleShowAllAuthTokens() { - this.set("showAllAuthTokens", !this.get("showAllAuthTokens")); + this.set("showAllAuthTokens", !this.showAllAuthTokens); }, revokeAuthToken(token) { diff --git a/app/assets/javascripts/discourse/controllers/preferences/categories.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/categories.js.es6 index cdd21a61510..76ee9b22f5a 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/categories.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/categories.js.es6 @@ -30,8 +30,8 @@ export default Ember.Controller.extend(PreferencesTabController, { actions: { save() { this.set("saved", false); - return this.get("model") - .save(this.get("saveAttrNames")) + return this.model + .save(this.saveAttrNames) .then(() => { this.set("saved", true); }) diff --git a/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 index 90936b5284f..859325fcf64 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 @@ -61,8 +61,8 @@ export default Ember.Controller.extend({ const self = this; this.set("saving", true); - return this.get("model") - .changeEmail(this.get("newEmail")) + return this.model + .changeEmail(this.newEmail) .then( () => self.set("success", true), e => { diff --git a/app/assets/javascripts/discourse/controllers/preferences/emails.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/emails.js.es6 index fd9c5374fca..57a81e56af3 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/emails.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/emails.js.es6 @@ -45,7 +45,7 @@ export default Ember.Controller.extend(PreferencesTabController, { @computed() mailingListModeOptions() { return [ - { name: this.get("frequencyEstimate"), value: 1 }, + { name: this.frequencyEstimate, value: 1 }, { name: I18n.t("user.mailing_list_mode.individual_no_echo"), value: 2 } ]; }, @@ -88,8 +88,8 @@ export default Ember.Controller.extend(PreferencesTabController, { actions: { save() { this.set("saved", false); - return this.get("model") - .save(this.get("saveAttrNames")) + return this.model + .save(this.saveAttrNames) .then(() => { this.set("saved", true); }) diff --git a/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 index f0ed39f8c4f..915db2d1654 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 @@ -89,7 +89,7 @@ export default Ember.Controller.extend(PreferencesTabController, { @observes("themeId") themeIdChanged() { - const id = this.get("themeId"); + const id = this.themeId; previewTheme([id]); }, @@ -131,18 +131,18 @@ export default Ember.Controller.extend(PreferencesTabController, { actions: { save() { this.set("saved", false); - const makeThemeDefault = this.get("makeThemeDefault"); + const makeThemeDefault = this.makeThemeDefault; if (makeThemeDefault) { - this.set("model.user_option.theme_ids", [this.get("themeId")]); + this.set("model.user_option.theme_ids", [this.themeId]); } - const makeTextSizeDefault = this.get("makeTextSizeDefault"); + const makeTextSizeDefault = this.makeTextSizeDefault; if (makeTextSizeDefault) { - this.set("model.user_option.text_size", this.get("textSize")); + this.set("model.user_option.text_size", this.textSize); } - return this.get("model") - .save(this.get("saveAttrNames")) + return this.model + .save(this.saveAttrNames) .then(() => { this.set("saved", true); @@ -150,25 +150,25 @@ export default Ember.Controller.extend(PreferencesTabController, { setLocalTheme([]); } else { setLocalTheme( - [this.get("themeId")], + [this.themeId], this.get("model.user_option.theme_key_seq") ); } if (makeTextSizeDefault) { - this.get("model").updateTextSizeCookie(null); + this.model.updateTextSizeCookie(null); } else { - this.get("model").updateTextSizeCookie(this.get("textSize")); + this.model.updateTextSizeCookie(this.textSize); } this.homeChanged(); - if (this.get("isiPad")) { - if (safariHacksDisabled() !== this.get("disableSafariHacks")) { + if (this.isiPad) { + if (safariHacksDisabled() !== this.disableSafariHacks) { Discourse.set("assetVersion", "forceRefresh"); } localStorage.setItem( "safari-hacks-disabled", - this.get("disableSafariHacks").toString() + this.disableSafariHacks.toString() ); } }) diff --git a/app/assets/javascripts/discourse/controllers/preferences/notifications.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/notifications.js.es6 index c680a311cfa..108011c977a 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/notifications.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/notifications.js.es6 @@ -68,8 +68,8 @@ export default Ember.Controller.extend(PreferencesTabController, { actions: { save() { this.set("saved", false); - return this.get("model") - .save(this.get("saveAttrNames")) + return this.model + .save(this.saveAttrNames) .then(() => { this.set("saved", true); }) diff --git a/app/assets/javascripts/discourse/controllers/preferences/profile.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/profile.js.es6 index 803eea2d876..c806d4a169f 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/profile.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/profile.js.es6 @@ -43,8 +43,8 @@ export default Ember.Controller.extend(PreferencesTabController, { save() { this.set("saved", false); - const model = this.get("model"), - userFields = this.get("userFields"); + const model = this.model, + userFields = this.userFields; // Update the user fields if (!Ember.isEmpty(userFields)) { @@ -57,7 +57,7 @@ export default Ember.Controller.extend(PreferencesTabController, { } return model - .save(this.get("saveAttrNames")) + .save(this.saveAttrNames) .then(() => { cookAsync(model.get("bio_raw")) .then(() => { diff --git a/app/assets/javascripts/discourse/controllers/preferences/second-factor-backup.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/second-factor-backup.js.es6 index 5f41061f97d..e5817ac9fa3 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/second-factor-backup.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/second-factor-backup.js.es6 @@ -60,14 +60,14 @@ export default Ember.Controller.extend({ disableSecondFactorBackup() { this.set("backupCodes", []); - if (!this.get("secondFactorToken")) return; + if (!this.secondFactorToken) return; this.set("loading", true); - this.get("model") + this.model .toggleSecondFactor( - this.get("secondFactorToken"), - this.get("secondFactorMethod"), + this.secondFactorToken, + this.secondFactorMethod, SECOND_FACTOR_METHODS.BACKUP_CODE, false ) @@ -79,7 +79,7 @@ export default Ember.Controller.extend({ this.set("errorMessage", null); - const usernameLower = this.get("model").username.toLowerCase(); + const usernameLower = this.model.username.toLowerCase(); DiscourseURL.redirectTo(userPath(`${usernameLower}/preferences`)); }) .catch(popupAjaxError) @@ -87,12 +87,12 @@ export default Ember.Controller.extend({ }, generateSecondFactorCodes() { - if (!this.get("secondFactorToken")) return; + if (!this.secondFactorToken) return; this.set("loading", true); - this.get("model") + this.model .generateSecondFactorCodes( - this.get("secondFactorToken"), - this.get("secondFactorMethod") + this.secondFactorToken, + this.secondFactorMethod ) .then(response => { if (response.error) { diff --git a/app/assets/javascripts/discourse/controllers/preferences/second-factor.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/second-factor.js.es6 index 75f8f4dd9cb..82be216d0d9 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/second-factor.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/second-factor.js.es6 @@ -45,13 +45,13 @@ export default Ember.Controller.extend({ }, toggleSecondFactor(enable) { - if (!this.get("secondFactorToken")) return; + if (!this.secondFactorToken) return; this.set("loading", true); - this.get("model") + this.model .toggleSecondFactor( - this.get("secondFactorToken"), - this.get("secondFactorMethod"), + this.secondFactorToken, + this.secondFactorMethod, SECOND_FACTOR_METHODS.TOTP, enable ) @@ -63,7 +63,7 @@ export default Ember.Controller.extend({ this.set("errorMessage", null); DiscourseURL.redirectTo( - userPath(`${this.get("model").username.toLowerCase()}/preferences`) + userPath(`${this.model.username.toLowerCase()}/preferences`) ); }) .catch(error => { @@ -74,11 +74,11 @@ export default Ember.Controller.extend({ actions: { confirmPassword() { - if (!this.get("password")) return; + if (!this.password) return; this.set("loading", true); - this.get("model") - .loadSecondFactorCodes(this.get("password")) + this.model + .loadSecondFactorCodes(this.password) .then(response => { if (response.error) { this.set("errorMessage", response.error); @@ -101,7 +101,7 @@ export default Ember.Controller.extend({ resetPasswordProgress: "" }); - return this.get("model") + return this.model .changePassword() .then(() => { this.set( diff --git a/app/assets/javascripts/discourse/controllers/preferences/tags.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/tags.js.es6 index 13cacdf3e06..5f970fa9f6d 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/tags.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/tags.js.es6 @@ -23,8 +23,8 @@ export default Ember.Controller.extend(PreferencesTabController, { actions: { save() { this.set("saved", false); - return this.get("model") - .save(this.get("saveAttrNames")) + return this.model + .save(this.saveAttrNames) .then(() => { this.set("saved", true); }) diff --git a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 index a6d1c99ad5b..4ef40b845cf 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 @@ -27,16 +27,16 @@ export default Ember.Controller.extend({ @observes("newUsername") checkTaken() { - let newUsername = this.get("newUsername"); + let newUsername = this.newUsername; - if (newUsername && newUsername.length < this.get("minLength")) { + if (newUsername && newUsername.length < this.minLength) { this.set("errorMessage", I18n.t("user.name.too_short")); } else { this.set("taken", false); this.set("errorMessage", null); - if (Ember.isEmpty(this.get("newUsername"))) return; - if (this.get("unchanged")) return; + if (Ember.isEmpty(this.newUsername)) return; + if (this.unchanged) return; Discourse.User.checkUsername( newUsername, @@ -60,7 +60,7 @@ export default Ember.Controller.extend({ actions: { changeUsername() { - if (this.get("saveDisabled")) { + if (this.saveDisabled) { return; } @@ -71,12 +71,12 @@ export default Ember.Controller.extend({ result => { if (result) { this.set("saving", true); - this.get("model") - .changeUsername(this.get("newUsername")) + this.model + .changeUsername(this.newUsername) .then(() => { DiscourseURL.redirectTo( userPath( - this.get("newUsername").toLowerCase() + "/preferences" + this.newUsername.toLowerCase() + "/preferences" ) ); }) diff --git a/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 index 4bb9a8885e4..88efe20a206 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 @@ -23,10 +23,10 @@ export default Ember.Controller.extend(PreferencesTabController, { controller.setProperties({ onClose: () => { if (!user.get("ignored")) { - const usernames = this.get("ignoredUsernames") + const usernames = this.ignoredUsernames .split(",") .removeAt( - this.get("ignoredUsernames").split(",").length - 1 + this.ignoredUsernames.split(",").length - 1 ) .join(","); this.set("ignoredUsernames", usernames); @@ -36,15 +36,15 @@ export default Ember.Controller.extend(PreferencesTabController, { }); } } else { - return this.get("model") + return this.model .save(["ignored_usernames"]) .catch(popupAjaxError); } }, save() { this.set("saved", false); - return this.get("model") - .save(this.get("saveAttrNames")) + return this.model + .save(this.saveAttrNames) .then(() => this.set("saved", true)) .catch(popupAjaxError); } diff --git a/app/assets/javascripts/discourse/controllers/rename-tag.js.es6 b/app/assets/javascripts/discourse/controllers/rename-tag.js.es6 index 5c97c4d40a2..63f4b81810f 100644 --- a/app/assets/javascripts/discourse/controllers/rename-tag.js.es6 +++ b/app/assets/javascripts/discourse/controllers/rename-tag.js.es6 @@ -16,7 +16,7 @@ export default Ember.Controller.extend(ModalFunctionality, BufferedContent, { actions: { performRename() { - const tag = this.get("model"), + const tag = this.model, self = this; tag .update({ id: this.get("buffered.id") }) diff --git a/app/assets/javascripts/discourse/controllers/reorder-categories.js.es6 b/app/assets/javascripts/discourse/controllers/reorder-categories.js.es6 index a3ccdf3bce2..f8e10c2391c 100644 --- a/app/assets/javascripts/discourse/controllers/reorder-categories.js.es6 +++ b/app/assets/javascripts/discourse/controllers/reorder-categories.js.es6 @@ -29,14 +29,14 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, { @computed("categoriesBuffered.@each.hasBufferedChanges") showApplyAll() { let anyChanged = false; - this.get("categoriesBuffered").forEach(bc => { + this.categoriesBuffered.forEach(bc => { anyChanged = anyChanged || bc.get("hasBufferedChanges"); }); return anyChanged; }, moveDir(cat, dir) { - const cats = this.get("categoriesOrdered"); + const cats = this.categoriesOrdered; const curIdx = cat.get("position"); let desiredIdx = curIdx + dir; if (desiredIdx >= 0 && desiredIdx < cats.get("length")) { @@ -84,7 +84,7 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, { parent/c2 other **/ fixIndices() { - const categories = this.get("categoriesOrdered"); + const categories = this.categoriesOrdered; const subcategories = {}; categories.forEach(category => { @@ -113,7 +113,7 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, { let position = parseInt($(e.target).val()); let amount = Math.min( Math.max(position, 0), - this.get("categoriesOrdered").length - 1 + this.categoriesOrdered.length - 1 ); this.moveDir(cat, amount - cat.get("position")); }, @@ -128,7 +128,7 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, { commit() { this.fixIndices(); - this.get("categoriesBuffered").forEach(bc => { + this.categoriesBuffered.forEach(bc => { if (bc.get("hasBufferedChanges")) { bc.applyBufferedChanges(); } @@ -140,7 +140,7 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, { this.send("commit"); const data = {}; - this.get("categoriesBuffered").forEach(cat => { + this.categoriesBuffered.forEach(cat => { data[cat.get("id")] = cat.get("position"); }); ajax("/categories/reorder", { diff --git a/app/assets/javascripts/discourse/controllers/request-group-membership-form.js.es6 b/app/assets/javascripts/discourse/controllers/request-group-membership-form.js.es6 index 228e5eb2adc..dd3a9951609 100644 --- a/app/assets/javascripts/discourse/controllers/request-group-membership-form.js.es6 +++ b/app/assets/javascripts/discourse/controllers/request-group-membership-form.js.es6 @@ -22,8 +22,8 @@ export default Ember.Controller.extend(ModalFunctionality, { if (this.currentUser) { this.set("loading", true); - this.get("model") - .requestMembership(this.get("reason")) + this.model + .requestMembership(this.reason) .then(result => { DiscourseURL.routeTo(result.relative_url); }) diff --git a/app/assets/javascripts/discourse/controllers/review-index.js.es6 b/app/assets/javascripts/discourse/controllers/review-index.js.es6 index 8367b207747..5c950982b61 100644 --- a/app/assets/javascripts/discourse/controllers/review-index.js.es6 +++ b/app/assets/javascripts/discourse/controllers/review-index.js.es6 @@ -26,7 +26,7 @@ export default Ember.Controller.extend({ @computed("reviewableTypes") allTypes() { - return (this.get("reviewableTypes") || []).map(type => { + return (this.reviewableTypes || []).map(type => { return { id: type, name: I18n.t(`review.types.${type.underscore()}.title`) @@ -69,7 +69,7 @@ export default Ember.Controller.extend({ return; } - let newList = this.get("reviewables").reject(reviewable => { + let newList = this.reviewables.reject(reviewable => { return ids.indexOf(reviewable.id) !== -1; }); this.set("reviewables", newList); @@ -82,17 +82,17 @@ export default Ember.Controller.extend({ refresh() { this.setProperties({ - type: this.get("filterType"), - priority: this.get("filterPriority"), - status: this.get("filterStatus"), - category_id: this.get("filterCategoryId"), - username: this.get("filterUsername") + type: this.filterType, + priority: this.filterPriority, + status: this.filterStatus, + category_id: this.filterCategoryId, + username: this.filterUsername }); this.send("refreshRoute"); }, loadMore() { - return this.get("reviewables").loadMore(); + return this.reviewables.loadMore(); }, toggleFilters() { diff --git a/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 b/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 index d242e319309..d2128efab14 100644 --- a/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 @@ -3,7 +3,7 @@ export default Ember.Controller.extend({ actions: { save() { - this.get("model").save(); + this.model.save(); }, destroy() { @@ -14,10 +14,10 @@ export default Ember.Controller.extend({ destroy => { if (destroy) { const c = this.get("tagGroups.model"); - return this.get("model") + return this.model .destroy() .then(() => { - c.removeObject(this.get("model")); + c.removeObject(this.model); this.transitionToRoute("tagGroups"); }); } diff --git a/app/assets/javascripts/discourse/controllers/tag-groups.js.es6 b/app/assets/javascripts/discourse/controllers/tag-groups.js.es6 index e464e44355e..e4515d90b96 100644 --- a/app/assets/javascripts/discourse/controllers/tag-groups.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tag-groups.js.es6 @@ -3,8 +3,8 @@ import TagGroup from "discourse/models/tag-group"; export default Ember.Controller.extend({ actions: { selectTagGroup(tagGroup) { - if (this.get("selectedItem")) { - this.get("selectedItem").set("selected", false); + if (this.selectedItem) { + this.selectedItem.set("selected", false); } this.set("selectedItem", tagGroup); tagGroup.set("selected", true); @@ -17,7 +17,7 @@ export default Ember.Controller.extend({ id: "new", name: I18n.t("tagging.groups.new_name") }); - this.get("model").pushObject(newTagGroup); + this.model.pushObject(newTagGroup); this.send("selectTagGroup", newTagGroup); } } diff --git a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 index 32141ceaa9e..0c1c77e6100 100644 --- a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 @@ -124,7 +124,7 @@ export default Ember.Controller.extend(BulkTopicSelection, { }, loadMoreTopics() { - return this.get("list").loadMore(); + return this.list.loadMore(); }, @observes("list.canLoadMore") @@ -151,7 +151,7 @@ export default Ember.Controller.extend(BulkTopicSelection, { actions: { changeSort(order) { - if (order === this.get("order")) { + if (order === this.order) { this.toggleProperty("ascending"); } else { this.setProperties({ order, ascending: false }); @@ -182,7 +182,7 @@ export default Ember.Controller.extend(BulkTopicSelection, { bootbox.confirm(confirmText, result => { if (!result) return; - this.get("tag") + this.tag .destroyRecord() .then(() => this.transitionToRoute("tags.index")) .catch(() => bootbox.alert(I18n.t("generic_error"))); @@ -190,7 +190,7 @@ export default Ember.Controller.extend(BulkTopicSelection, { }, changeTagNotification(id) { - const tagNotification = this.get("tagNotification"); + const tagNotification = this.tagNotification; tagNotification.update({ notification_level: id }); } } diff --git a/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 b/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 index 89badf83965..9f5752e5c61 100644 --- a/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 @@ -101,7 +101,7 @@ export default Ember.Controller.extend(ModalFunctionality, { this.perform(operation).then(topics => { if (topics) { topics.forEach(cb); - (this.get("refreshClosure") || identity)(); + (this.refreshClosure || identity)(); this.send("closeModal"); } }); @@ -109,7 +109,7 @@ export default Ember.Controller.extend(ModalFunctionality, { performAndRefresh(operation) { return this.perform(operation).then(() => { - (this.get("refreshClosure") || identity)(); + (this.refreshClosure || identity)(); this.send("closeModal"); }); }, @@ -124,7 +124,7 @@ export default Ember.Controller.extend(ModalFunctionality, { }, changeTags() { - this.performAndRefresh({ type: "change_tags", tags: this.get("tags") }); + this.performAndRefresh({ type: "change_tags", tags: this.tags }); }, showAppendTagTopics() { @@ -136,7 +136,7 @@ export default Ember.Controller.extend(ModalFunctionality, { }, appendTags() { - this.performAndRefresh({ type: "append_tags", tags: this.get("tags") }); + this.performAndRefresh({ type: "append_tags", tags: this.tags }); }, showChangeCategory() { @@ -168,13 +168,13 @@ export default Ember.Controller.extend(ModalFunctionality, { }, changeCategory() { - const categoryId = parseInt(this.get("newCategoryId"), 10) || 0; + const categoryId = parseInt(this.newCategoryId, 10) || 0; const category = Discourse.Category.findById(categoryId); this.perform({ type: "change_category", category_id: categoryId }).then( topics => { topics.forEach(t => t.set("category", category)); - (this.get("refreshClosure") || identity)(); + (this.refreshClosure || identity)(); this.send("closeModal"); } ); diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index cca7caf5d1b..d57fbd22d33 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -174,10 +174,10 @@ export default Ember.Controller.extend(bufferedProperty("model"), { _updateSelectedPostIds(postIds) { const smallActionsPostIds = this._smallActionPostIds(); - this.get("selectedPostIds").pushObjects( + this.selectedPostIds.pushObjects( postIds.filter(postId => !smallActionsPostIds.has(postId)) ); - this.set("selectedPostIds", [...new Set(this.get("selectedPostIds"))]); + this.set("selectedPostIds", [...new Set(this.selectedPostIds)]); this._forceRefreshPostStream(); }, @@ -200,7 +200,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, _loadPostIds(post) { - if (this.get("loadingPostIds")) return; + if (this.loadingPostIds) return; const postStream = this.get("model.postStream"); const url = `/t/${this.get("model.id")}/post_ids.json`; @@ -247,7 +247,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { return this.get("model.postStream") .loadPost(postId) .then(post => { - const composer = this.get("composer"); + const composer = this.composer; const viewOpen = composer.get("model.viewOpen"); const quotedText = Quote.build(post, buffer); @@ -302,7 +302,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { } const postNumber = post.get("post_number"); - const topic = this.get("model"); + const topic = this.model; topic.set("currentPost", postNumber); if (postNumber > (topic.get("last_read_post_number") || 0)) { topic.set("last_read_post_id", post.get("id")); @@ -390,7 +390,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { // Archive a PM (as opposed to archiving a topic) toggleArchiveMessage() { - const topic = this.get("model"); + const topic = this.model; if (topic.get("archiving")) { return; @@ -426,9 +426,9 @@ export default Ember.Controller.extend(bufferedProperty("model"), { // Post related methods replyToPost(post) { - const composerController = this.get("composer"); - const topic = post ? post.get("topic") : this.get("model"); - const quoteState = this.get("quoteState"); + const composerController = this.composer; + const topic = post ? post.get("topic") : this.model; + const quoteState = this.quoteState; const postStream = this.get("model.postStream"); if (!postStream || !topic || !topic.get("details.can_create_post")) { @@ -569,8 +569,8 @@ export default Ember.Controller.extend(bufferedProperty("model"), { return false; } - const composer = this.get("composer"); - let topic = this.get("model"); + const composer = this.composer; + let topic = this.model; const composerModel = composer.get("model"); let editingFirst = composerModel && @@ -607,7 +607,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { } else if (post) { return post.toggleBookmark().catch(popupAjaxError); } else { - return this.get("model") + return this.model .toggleBookmark() .then(changedIds => { if (!changedIds) { @@ -629,7 +629,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, jumpToPostPrompt() { - const topic = this.get("model"); + const topic = this.model; const controller = showModal("jump-to-post", { modalClass: "jump-to-post-modal" }); @@ -704,7 +704,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, togglePostSelection(post) { - const selected = this.get("selectedPostIds"); + const selected = this.selectedPostIds; selected.includes(post.id) ? selected.removeObject(post.id) : selected.addObject(post.id); @@ -713,7 +713,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { selectReplies(post) { ajax(`/posts/${post.id}/reply-ids.json`).then(replies => { const replyIds = replies.map(r => r.id); - this.get("selectedPostIds").pushObjects([post.id, ...replyIds]); + this.selectedPostIds.pushObjects([post.id, ...replyIds]); this._forceRefreshPostStream(); }); }, @@ -733,14 +733,14 @@ export default Ember.Controller.extend(bufferedProperty("model"), { bootbox.confirm( I18n.t("post.delete.confirm", { - count: this.get("selectedPostsCount") + count: this.selectedPostsCount }), result => { if (result) { // If all posts are selected, it's the same thing as deleting the topic - if (this.get("selectedAllPosts")) return this.deleteTopic(); + if (this.selectedAllPosts) return this.deleteTopic(); - Post.deleteMany(this.get("selectedPostIds")); + Post.deleteMany(this.selectedPostIds); this.get("model.postStream.posts").forEach( p => this.postSelected(p) && p.setDeletedState(user) ); @@ -752,10 +752,10 @@ export default Ember.Controller.extend(bufferedProperty("model"), { mergePosts() { bootbox.confirm( - I18n.t("post.merge.confirm", { count: this.get("selectedPostsCount") }), + I18n.t("post.merge.confirm", { count: this.selectedPostsCount }), result => { if (result) { - Post.mergePosts(this.get("selectedPostIds")); + Post.mergePosts(this.selectedPostIds); this.send("toggleMultiSelect"); } } @@ -815,14 +815,14 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, finishedEditingTopic() { - if (!this.get("editingTopic")) { + if (!this.editingTopic) { return; } // save the modifications const props = this.get("buffered.buffer"); - Topic.update(this.get("model"), props) + Topic.update(this.model, props) .then(() => { // We roll back on success here because `update` saves the properties to the topic this.rollbackBuffer(); @@ -836,13 +836,13 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, toggleVisibility() { - this.get("model").toggleStatus("visible"); + this.model.toggleStatus("visible"); }, toggleClosed() { - const topic = this.get("model"); + const topic = this.model; - this.get("model") + this.model .toggleStatus("closed") .then(result => { topic.set("topic_status_update", result.topic_status_update); @@ -850,20 +850,20 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, recoverTopic() { - this.get("model").recover(); + this.model.recover(); }, makeBanner() { - this.get("model").makeBanner(); + this.model.makeBanner(); }, removeBanner() { - this.get("model").removeBanner(); + this.model.removeBanner(); }, togglePinned() { const value = this.get("model.pinned_at") ? false : true, - topic = this.get("model"), + topic = this.model, until = this.get("model.pinnedInCategoryUntil"); // optimistic update @@ -877,7 +877,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, pinGlobally() { - const topic = this.get("model"), + const topic = this.model, until = this.get("model.pinnedGloballyUntil"); // optimistic update @@ -891,16 +891,16 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, toggleArchived() { - this.get("model").toggleStatus("archived"); + this.model.toggleStatus("archived"); }, clearPin() { - this.get("model").clearPin(); + this.model.clearPin(); }, togglePinnedForUser() { if (this.get("model.pinned_at")) { - const topic = this.get("model"); + const topic = this.model; if (topic.get("pinned")) { topic.clearPin(); } else { @@ -910,7 +910,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, replyAsNewTopic(post, quotedText) { - const composerController = this.get("composer"); + const composerController = this.composer; const { quoteState } = this; quotedText = quotedText || Quote.build(post, quoteState.buffer); @@ -991,11 +991,11 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, convertToPublicTopic() { - this.get("model").convertTopic("public"); + this.model.convertTopic("public"); }, convertToPrivateMessage() { - this.get("model").convertTopic("private"); + this.model.convertTopic("private"); }, removeFeaturedLink() { @@ -1003,7 +1003,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, resetBumpDate() { - this.get("model").resetBumpDate(); + this.model.resetBumpDate(); } }, @@ -1026,7 +1026,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { .loadNearestPostToDate(date) .then(post => { DiscourseURL.routeTo( - this.get("model").urlForPostNumber(post.get("post_number")) + this.model.urlForPostNumber(post.get("post_number")) ); }) .catch(() => { @@ -1040,12 +1040,12 @@ export default Ember.Controller.extend(bufferedProperty("model"), { if (post) { DiscourseURL.routeTo( - this.get("model").urlForPostNumber(post.get("post_number")) + this.model.urlForPostNumber(post.get("post_number")) ); } else { postStream.loadPostByPostNumber(postNumber).then(p => { DiscourseURL.routeTo( - this.get("model").urlForPostNumber(p.get("post_number")) + this.model.urlForPostNumber(p.get("post_number")) ); }); } @@ -1062,7 +1062,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { this.appEvents.trigger("topic:jump-to-post", postId); - const topic = this.get("model"); + const topic = this.model; const postStream = topic.get("postStream"); const post = postStream.findLoadedPost(postId); @@ -1198,8 +1198,8 @@ export default Ember.Controller.extend(bufferedProperty("model"), { postSelected(post) { return ( - this.get("selectedAllPost") || - this.get("selectedPostIds").includes(post.id) + this.selectedAllPost || + this.selectedPostIds.includes(post.id) ); }, @@ -1209,11 +1209,11 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, recoverTopic() { - this.get("model").recover(); + this.model.recover(); }, deleteTopic() { - this.get("model").destroy(this.currentUser); + this.model.destroy(this.currentUser); }, subscribe() { @@ -1224,7 +1224,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { this.messageBus.subscribe( `/topic/${this.get("model.id")}`, data => { - const topic = this.get("model"); + const topic = this.model; if (Ember.isPresent(data.notification_level_change)) { topic.set( @@ -1349,7 +1349,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { }, readPosts(topicId, postNumbers) { - const topic = this.get("model"); + const topic = this.model; const postStream = topic.get("postStream"); if (topic.get("id") === topicId) { diff --git a/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 b/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 index 6a050fab769..73397bb07a9 100644 --- a/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 +++ b/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 @@ -43,23 +43,23 @@ export default Ember.Controller.extend(ModalFunctionality, { @observes("selection") _selectionChanged() { - if (this.get("local")) { + if (this.local) { this.set("showMore", false); } }, actions: { upload() { - if (this.get("local")) { + if (this.local) { $(".wmd-controls").fileupload("add", { fileInput: $("#filename-input") }); } else { - const imageUrl = this.get("imageUrl") || ""; - const imageLink = this.get("imageLink") || ""; - const toolbarEvent = this.get("toolbarEvent"); + const imageUrl = this.imageUrl || ""; + const imageLink = this.imageLink || ""; + const toolbarEvent = this.toolbarEvent; - if (this.get("showMore") && imageLink.length > 3) { + if (this.showMore && imageLink.length > 3) { toolbarEvent.addText(`[![](${imageUrl})](${imageLink})`); } else if (imageUrl.match(/\.(jpg|jpeg|png|gif)$/)) { toolbarEvent.addText(`![](${imageUrl})`); diff --git a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 index cd4ca93ad7a..e214e588264 100644 --- a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 @@ -9,9 +9,9 @@ export default Ember.Controller.extend({ _showFooter: function() { var showFooter; - if (this.get("userActionType")) { + if (this.userActionType) { const stat = (this.get("model.stats") || []).find( - s => s.action_type === this.get("userActionType") + s => s.action_type === this.userActionType ); showFooter = stat && stat.count <= this.get("model.stream.itemsLoaded"); } else { diff --git a/app/assets/javascripts/discourse/controllers/user-card.js.es6 b/app/assets/javascripts/discourse/controllers/user-card.js.es6 index b5d0ba39fee..cf84b13232c 100644 --- a/app/assets/javascripts/discourse/controllers/user-card.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-card.js.es6 @@ -10,7 +10,7 @@ export default Ember.Controller.extend({ actions: { togglePosts(user) { - const topicController = this.get("topic"); + const topicController = this.topic; topicController.send("toggleParticipant", user); }, diff --git a/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 b/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 index 1c4a6c460c8..d689dc54cfc 100644 --- a/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 @@ -27,9 +27,9 @@ export default Ember.Controller.extend({ @observes("searchTerm") _searchTermChanged: debounce(function() { Invite.findInvitedBy( - this.get("user"), - this.get("filter"), - this.get("searchTerm") + this.user, + this.filter, + this.searchTerm ).then(invites => this.set("model", invites)); }, 250), @@ -39,7 +39,7 @@ export default Ember.Controller.extend({ showBulkActionButtons(filter) { return ( filter === "pending" && - this.get("model").invites.length > 4 && + this.model.invites.length > 4 && this.currentUser.get("staff") ); }, @@ -112,14 +112,14 @@ export default Ember.Controller.extend({ }, loadMore() { - const model = this.get("model"); + const model = this.model; - if (this.get("canLoadMore") && !this.get("invitesLoading")) { + if (this.canLoadMore && !this.invitesLoading) { this.set("invitesLoading", true); Invite.findInvitedBy( - this.get("user"), - this.get("filter"), - this.get("searchTerm"), + this.user, + this.filter, + this.searchTerm, model.invites.length ).then(invite_model => { this.set("invitesLoading", false); diff --git a/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 b/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 index b8bd856bd0b..bb94ee6f509 100644 --- a/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 @@ -27,12 +27,12 @@ export default Ember.Controller.extend({ actions: { resetNew() { ajax("/notifications/mark-read", { method: "PUT" }).then(() => { - this.get("model").forEach(n => n.set("read", true)); + this.model.forEach(n => n.set("read", true)); }); }, loadMore() { - this.get("model").loadMore(); + this.model.loadMore(); } } }); diff --git a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 index 917f552709b..62fc7a2a5cf 100644 --- a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 @@ -39,10 +39,10 @@ export default Ember.Controller.extend({ }, bulkOperation(operation) { - const selected = this.get("selected"); + const selected = this.selected; var params = { type: operation }; - if (this.get("isGroup")) { - params.group = this.get("groupFilter"); + if (this.isGroup) { + params.group = this.groupFilter; } Topic.bulkOperation(selected, params).then( diff --git a/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 b/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 index fcf68228481..35f67bc43d1 100644 --- a/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 @@ -24,15 +24,15 @@ export default Ember.Controller.extend({ this.set("channel", channel); this.messageBus.subscribe(channel, data => { - if (this.get("newIncoming").indexOf(data.topic_id) === -1) { - this.get("newIncoming").push(data.topic_id); + if (this.newIncoming.indexOf(data.topic_id) === -1) { + this.newIncoming.push(data.topic_id); this.incrementProperty("incomingCount"); } }); }, unsubscribe() { - const channel = this.get("channel"); + const channel = this.channel; if (channel) this.messageBus.unsubscribe(channel); this._resetTracking(); this.set("channel", null); @@ -47,11 +47,11 @@ export default Ember.Controller.extend({ actions: { loadMore: function() { - this.get("model").loadMore(); + this.model.loadMore(); }, showInserted() { - this.get("model").loadBefore(this.get("newIncoming")); + this.model.loadBefore(this.newIncoming); this._resetTracking(); return false; } diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6 index 85e6c3fa673..0051d0377e7 100644 --- a/app/assets/javascripts/discourse/controllers/user.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user.js.es6 @@ -140,18 +140,18 @@ export default Ember.Controller.extend(CanCheckEmails, { }, showSuspensions() { - this.get("adminTools").showActionLogs(this, { + this.adminTools.showActionLogs(this, { target_user: this.get("model.username"), action_name: "suspend_user" }); }, adminDelete() { - this.get("adminTools").deleteUser(this.get("model.id")); + this.adminTools.deleteUser(this.get("model.id")); }, updateNotificationLevel(level) { - const user = this.get("model"); + const user = this.model; return user.updateNotificationLevel(level); } } diff --git a/app/assets/javascripts/discourse/controllers/users.js.es6 b/app/assets/javascripts/discourse/controllers/users.js.es6 index cc6157d3725..2fa9a8de59a 100644 --- a/app/assets/javascripts/discourse/controllers/users.js.es6 +++ b/app/assets/javascripts/discourse/controllers/users.js.es6 @@ -13,7 +13,7 @@ export default Ember.Controller.extend({ showTimeRead: Ember.computed.equal("period", "all"), _setName: debounce(function() { - this.set("name", this.get("nameInput")); + this.set("name", this.nameInput); }, 500).observes("nameInput"), _showFooter: function() { @@ -22,7 +22,7 @@ export default Ember.Controller.extend({ actions: { loadMore() { - this.get("model").loadMore(); + this.model.loadMore(); } } }); diff --git a/app/assets/javascripts/discourse/initializers/topic-footer-buttons.js.es6 b/app/assets/javascripts/discourse/initializers/topic-footer-buttons.js.es6 index 1bf23f47660..ccb2e2e9d1f 100644 --- a/app/assets/javascripts/discourse/initializers/topic-footer-buttons.js.es6 +++ b/app/assets/javascripts/discourse/initializers/topic-footer-buttons.js.es6 @@ -17,17 +17,17 @@ export default { id: "share", title: "topic.share.extended_title", model: { - topic: this.get("topic") + topic: this.topic } } ]; - if (this.get("canInviteTo") && !this.get("inviteDisabled")) { + if (this.canInviteTo && !this.inviteDisabled) { let invitePanelTitle; - if (this.get("isPM")) { + if (this.isPM) { invitePanelTitle = "topic.invite_private.title"; - } else if (this.get("invitingToTopic")) { + } else if (this.invitingToTopic) { invitePanelTitle = "topic.invite_reply.title"; } else { invitePanelTitle = "user.invited.create"; @@ -37,7 +37,7 @@ export default { id: "invite", title: invitePanelTitle, model: { - inviteModel: this.get("topic") + inviteModel: this.topic } }); } @@ -113,13 +113,13 @@ export default { id: "archive", priority: 996, icon() { - return this.get("archiveIcon"); + return this.archiveIcon; }, label() { - return this.get("archiveLabel"); + return this.archiveLabel; }, title() { - return this.get("archiveTitle"); + return this.archiveTitle; }, action: "toggleArchiveMessage", classNames: ["standard", "archive-topic"], @@ -131,7 +131,7 @@ export default { "toggleArchiveMessage" ], displayed() { - return this.get("canArchive"); + return this.canArchive; } }); @@ -145,7 +145,7 @@ export default { classNames: ["edit-message"], dependentKeys: ["editFirstPost", "showEditOnFooter"], displayed() { - return this.get("showEditOnFooter"); + return this.showEditOnFooter; } }); } diff --git a/app/assets/javascripts/discourse/lib/posts-with-placeholders.js.es6 b/app/assets/javascripts/discourse/lib/posts-with-placeholders.js.es6 index 49bb5cd5cfd..03271c6d6b7 100644 --- a/app/assets/javascripts/discourse/lib/posts-with-placeholders.js.es6 +++ b/app/assets/javascripts/discourse/lib/posts-with-placeholders.js.es6 @@ -53,7 +53,7 @@ export default Ember.Object.extend(Ember.Array, { const appendingIds = this._appendingIds; postIds.forEach(pid => (appendingIds[pid] = true)); }, - this.get("length"), + this.length, 0, postIds.length ); @@ -76,7 +76,7 @@ export default Ember.Object.extend(Ember.Array, { }, objectAt(index) { - const posts = this.get("posts"); + const posts = this.posts; return index < posts.length ? posts[index] : new Placeholder("post-placeholder"); diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index 37328433461..ec111f281a5 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -424,7 +424,7 @@ const DiscourseURL = Ember.Object.extend({ handleURL(path, opts) { opts = opts || {}; - const router = this.get("router"); + const router = this.router; if (opts.replaceURL) { this.replaceState(path); diff --git a/app/assets/javascripts/discourse/mixins/add-archetype-class.js.es6 b/app/assets/javascripts/discourse/mixins/add-archetype-class.js.es6 index eb157699cca..a8a2c3c5288 100644 --- a/app/assets/javascripts/discourse/mixins/add-archetype-class.js.es6 +++ b/app/assets/javascripts/discourse/mixins/add-archetype-class.js.es6 @@ -13,7 +13,7 @@ export default { @observes("archetype") @on("init") _archetypeChanged() { - const archetype = this.get("archetype"); + const archetype = this.archetype; this._cleanUp(); if (archetype) { diff --git a/app/assets/javascripts/discourse/mixins/badge-select-controller.js.es6 b/app/assets/javascripts/discourse/mixins/badge-select-controller.js.es6 index b4d61fcbba5..449030dad22 100644 --- a/app/assets/javascripts/discourse/mixins/badge-select-controller.js.es6 +++ b/app/assets/javascripts/discourse/mixins/badge-select-controller.js.es6 @@ -27,7 +27,7 @@ export default Ember.Mixin.create({ selectedUserBadge(selectedUserBadgeId) { selectedUserBadgeId = parseInt(selectedUserBadgeId); let selectedUserBadge = null; - this.get("selectableUserBadges").forEach(function(userBadge) { + this.selectableUserBadges.forEach(function(userBadge) { if (userBadge.get("id") === selectedUserBadgeId) { selectedUserBadge = userBadge; } diff --git a/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 b/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 index 8630c297000..aefee9990e5 100644 --- a/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 +++ b/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 @@ -8,11 +8,11 @@ export function bufferedProperty(property) { }.property(property), rollbackBuffer: function() { - this.get("buffered").discardBufferedChanges(); + this.buffered.discardBufferedChanges(); }, commitBuffer: function() { - this.get("buffered").applyBufferedChanges(); + this.buffered.applyBufferedChanges(); } }; diff --git a/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 b/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 index 8db10c5d22b..d5cfcaaf2ad 100644 --- a/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 +++ b/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 @@ -13,12 +13,12 @@ export default Ember.Mixin.create({ actions: { toggleBulkSelect() { this.toggleProperty("bulkSelectEnabled"); - this.get("selected").clear(); + this.selected.clear(); }, dismissRead(operationType) { const self = this, - selected = this.get("selected"); + selected = this.selected; let operation; if (operationType === "posts") { diff --git a/app/assets/javascripts/discourse/mixins/card-contents-base.js.es6 b/app/assets/javascripts/discourse/mixins/card-contents-base.js.es6 index 3158d31f06c..383d5989f8c 100644 --- a/app/assets/javascripts/discourse/mixins/card-contents-base.js.es6 +++ b/app/assets/javascripts/discourse/mixins/card-contents-base.js.es6 @@ -33,14 +33,14 @@ export default Ember.Mixin.create({ return false; } - const currentUsername = this.get("username"); - if (username === currentUsername && this.get("loading") === username) { + const currentUsername = this.username; + if (username === currentUsername && this.loading === username) { return; } const postId = $target.parents("article").data("post-id"); - const wasVisible = this.get("visible"); - const previousTarget = this.get("cardTarget"); + const wasVisible = this.visible; + const previousTarget = this.cardTarget; const target = $target[0]; if (wasVisible) { @@ -51,8 +51,8 @@ export default Ember.Mixin.create({ } const post = - this.get("viewingTopic") && postId - ? this.get("postStream").findLoadedPost(postId) + this.viewingTopic && postId + ? this.postStream.findLoadedPost(postId) : null; this.setProperties({ username, @@ -74,8 +74,8 @@ export default Ember.Mixin.create({ didInsertElement() { this._super(...arguments); afterTransition(this.$(), this._hide.bind(this)); - const id = this.get("elementId"); - const triggeringLinkClass = this.get("triggeringLinkClass"); + const id = this.elementId; + const triggeringLinkClass = this.triggeringLinkClass; const clickOutsideEventName = `mousedown.outside-${id}`; const clickDataExpand = `click.discourse-${id}`; const clickMention = `click.discourse-${id}-${triggeringLinkClass}`; @@ -93,7 +93,7 @@ export default Ember.Mixin.create({ $("html") .off(clickOutsideEventName) .on(clickOutsideEventName, e => { - if (this.get("visible")) { + if (this.visible) { const $target = $(e.target); if ( $target.closest(`[data-${id}]`).data(id) || @@ -134,7 +134,7 @@ export default Ember.Mixin.create({ }, _bindMobileScroll() { - const mobileScrollEvent = this.get("mobileScrollEvent"); + const mobileScrollEvent = this.mobileScrollEvent; const onScroll = () => { Ember.run.throttle(this, this._close, 1000); }; @@ -143,7 +143,7 @@ export default Ember.Mixin.create({ }, _unbindMobileScroll() { - const mobileScrollEvent = this.get("mobileScrollEvent"); + const mobileScrollEvent = this.mobileScrollEvent; $(window).off(mobileScrollEvent); }, @@ -160,8 +160,8 @@ export default Ember.Mixin.create({ } const width = this.$().width(); const height = 175; - const isFixed = this.get("isFixed"); - const isDocked = this.get("isDocked"); + const isFixed = this.isFixed; + const isDocked = this.isDocked; let verticalAdjustments = 0; @@ -245,7 +245,7 @@ export default Ember.Mixin.create({ }, _hide() { - if (!this.get("visible")) { + if (!this.visible) { this.$().css({ left: -9999, top: -9999 }); if (this.site.mobileView) { $(".card-cloak").addClass("hidden"); @@ -272,10 +272,10 @@ export default Ember.Mixin.create({ willDestroyElement() { this._super(...arguments); - const clickOutsideEventName = this.get("clickOutsideEventName"); - const clickDataExpand = this.get("clickDataExpand"); - const clickMention = this.get("clickMention"); - const previewClickEvent = this.get("previewClickEvent"); + const clickOutsideEventName = this.clickOutsideEventName; + const clickDataExpand = this.clickDataExpand; + const clickMention = this.clickMention; + const previewClickEvent = this.previewClickEvent; $("html").off(clickOutsideEventName); $("#main") @@ -287,7 +287,7 @@ export default Ember.Mixin.create({ keyUp(e) { if (e.keyCode === 27) { // ESC - const target = this.get("cardTarget"); + const target = this.cardTarget; this._close(); target.focus(); } diff --git a/app/assets/javascripts/discourse/mixins/grant-badge-controller.js.es6 b/app/assets/javascripts/discourse/mixins/grant-badge-controller.js.es6 index 1c777758a1f..cc0d82fd879 100644 --- a/app/assets/javascripts/discourse/mixins/grant-badge-controller.js.es6 +++ b/app/assets/javascripts/discourse/mixins/grant-badge-controller.js.es6 @@ -40,7 +40,7 @@ export default Ember.Mixin.create({ grantBadge(selectedBadgeId, username, badgeReason) { return UserBadge.grant(selectedBadgeId, username, badgeReason).then( newBadge => { - this.get("userBadges").pushObject(newBadge); + this.userBadges.pushObject(newBadge); return newBadge; }, error => { diff --git a/app/assets/javascripts/discourse/mixins/load-more.js.es6 b/app/assets/javascripts/discourse/mixins/load-more.js.es6 index df3e0e2280f..caf86100ea5 100644 --- a/app/assets/javascripts/discourse/mixins/load-more.js.es6 +++ b/app/assets/javascripts/discourse/mixins/load-more.js.es6 @@ -5,7 +5,7 @@ import { on } from "ember-addons/ember-computed-decorators"; // Provides the ability to load more items for a view which is scrolled to the bottom. export default Ember.Mixin.create(Scrolling, { scrolled() { - const eyeline = this.get("eyeline"); + const eyeline = this.eyeline; return eyeline && eyeline.update(); }, @@ -17,7 +17,7 @@ export default Ember.Mixin.create(Scrolling, { @on("didInsertElement") _bindEyeline() { - const eyeline = new Eyeline(this.get("eyelineSelector") + ":last"); + const eyeline = new Eyeline(this.eyelineSelector + ":last"); this.set("eyeline", eyeline); eyeline.on("sawBottom", () => this.send("loadMore")); this.bindScrolling(); diff --git a/app/assets/javascripts/discourse/mixins/modal-functionality.js.es6 b/app/assets/javascripts/discourse/mixins/modal-functionality.js.es6 index 0caef439430..cb4ba7717f1 100644 --- a/app/assets/javascripts/discourse/mixins/modal-functionality.js.es6 +++ b/app/assets/javascripts/discourse/mixins/modal-functionality.js.es6 @@ -15,7 +15,7 @@ export default Ember.Mixin.create({ actions: { closeModal() { - this.get("modal").send("closeModal"); + this.modal.send("closeModal"); this.set("panels", []); }, diff --git a/app/assets/javascripts/discourse/mixins/name-validation.js.es6 b/app/assets/javascripts/discourse/mixins/name-validation.js.es6 index a4c8dc5452c..5b505c13598 100644 --- a/app/assets/javascripts/discourse/mixins/name-validation.js.es6 +++ b/app/assets/javascripts/discourse/mixins/name-validation.js.es6 @@ -16,7 +16,7 @@ export default Ember.Mixin.create({ nameValidation() { if ( this.siteSettings.full_name_required && - Ember.isEmpty(this.get("accountName")) + Ember.isEmpty(this.accountName) ) { return InputValidation.create({ failed: true }); } diff --git a/app/assets/javascripts/discourse/mixins/pan-events.js.es6 b/app/assets/javascripts/discourse/mixins/pan-events.js.es6 index 2b4dc4dd1e7..d64f714917e 100644 --- a/app/assets/javascripts/discourse/mixins/pan-events.js.es6 +++ b/app/assets/javascripts/discourse/mixins/pan-events.js.es6 @@ -115,11 +115,11 @@ export default Ember.Mixin.create({ }, _panMove(e, originalEvent) { - if (!this.get("_panState")) { + if (!this._panState) { this._panStart(e); return; } - const previousState = this.get("_panState"); + const previousState = this._panState; const newState = this._calculateNewPanState(previousState, e); if (previousState.start && newState.distance < MINIMUM_SWIPE_DISTANCE) { return; diff --git a/app/assets/javascripts/discourse/mixins/password-validation.js.es6 b/app/assets/javascripts/discourse/mixins/password-validation.js.es6 index 7f2ec93d816..50a98e87908 100644 --- a/app/assets/javascripts/discourse/mixins/password-validation.js.es6 +++ b/app/assets/javascripts/discourse/mixins/password-validation.js.es6 @@ -13,7 +13,7 @@ export default Ember.Mixin.create({ @computed("passwordMinLength") passwordInstructions() { return I18n.t("user.password.instructions", { - count: this.get("passwordMinLength") + count: this.passwordMinLength }); }, @@ -48,7 +48,7 @@ export default Ember.Mixin.create({ return InputValidation.create({ failed: true, reason: - this.get("rejectedPasswordsMessages").get(password) || + this.rejectedPasswordsMessages.get(password) || I18n.t("user.password.common") }); } diff --git a/app/assets/javascripts/discourse/mixins/upload.js.es6 b/app/assets/javascripts/discourse/mixins/upload.js.es6 index ca70caa781e..ce46d04c031 100644 --- a/app/assets/javascripts/discourse/mixins/upload.js.es6 +++ b/app/assets/javascripts/discourse/mixins/upload.js.es6 @@ -82,10 +82,10 @@ export default Ember.Mixin.create({ this.validateUploadedFilesOptions() ); const isValid = validateUploadedFiles(data.files, opts); - const type = this.get("type"); + const type = this.type; let form = type ? { type } : {}; - if (this.get("data")) { - form = $.extend(form, this.get("data")); + if (this.data) { + form = $.extend(form, this.data); } data.formData = form; this.setProperties({ uploadProgress: 0, uploading: isValid }); @@ -107,7 +107,7 @@ export default Ember.Mixin.create({ _destroy: function() { this.messageBus && - this.messageBus.unsubscribe("/uploads/" + this.get("type")); + this.messageBus.unsubscribe("/uploads/" + this.type); const $upload = this.$(); try { diff --git a/app/assets/javascripts/discourse/mixins/user-fields-validation.js.es6 b/app/assets/javascripts/discourse/mixins/user-fields-validation.js.es6 index 01cb3ace4cf..57a4b9cec0a 100644 --- a/app/assets/javascripts/discourse/mixins/user-fields-validation.js.es6 +++ b/app/assets/javascripts/discourse/mixins/user-fields-validation.js.es6 @@ -23,7 +23,7 @@ export default Ember.Mixin.create({ // Validate required fields @computed("userFields.@each.value") userFieldsValidation() { - let userFields = this.get("userFields"); + let userFields = this.userFields; if (userFields) { userFields = userFields.filterBy("field.required"); } diff --git a/app/assets/javascripts/discourse/mixins/username-validation.js.es6 b/app/assets/javascripts/discourse/mixins/username-validation.js.es6 index 83df3c3dba9..646f7f6ba9b 100644 --- a/app/assets/javascripts/discourse/mixins/username-validation.js.es6 +++ b/app/assets/javascripts/discourse/mixins/username-validation.js.es6 @@ -11,7 +11,7 @@ export default Ember.Mixin.create({ fetchExistingUsername: debounce(function() { const self = this; - Discourse.User.checkUsername(null, this.get("accountEmail")).then(function( + Discourse.User.checkUsername(null, this.accountEmail).then(function( result ) { if ( @@ -29,7 +29,7 @@ export default Ember.Mixin.create({ basicUsernameValidation(accountUsername) { this.set("uniqueUsernameValidation", null); - if (accountUsername && accountUsername === this.get("prefilledUsername")) { + if (accountUsername && accountUsername === this.prefilledUsername) { return InputValidation.create({ ok: true, reason: I18n.t("user.username.prefilled") @@ -52,7 +52,7 @@ export default Ember.Mixin.create({ } // If too long - if (accountUsername.length > this.get("maxUsernameLength")) { + if (accountUsername.length > this.maxUsernameLength) { return InputValidation.create({ failed: true, reason: I18n.t("user.username.too_long") @@ -69,16 +69,16 @@ export default Ember.Mixin.create({ shouldCheckUsernameAvailability: function() { return ( - !Ember.isEmpty(this.get("accountUsername")) && - this.get("accountUsername").length >= this.get("minUsernameLength") + !Ember.isEmpty(this.accountUsername) && + this.accountUsername.length >= this.minUsernameLength ); }, checkUsernameAvailability: debounce(function() { if (this.shouldCheckUsernameAvailability()) { return Discourse.User.checkUsername( - this.get("accountUsername"), - this.get("accountEmail") + this.accountUsername, + this.accountEmail ).then(result => { this.set("isDeveloper", false); if (result.available) { @@ -120,8 +120,8 @@ export default Ember.Mixin.create({ // Actually wait for the async name check before we're 100% sure we're good to go @computed("uniqueUsernameValidation", "basicUsernameValidation") usernameValidation() { - const basicValidation = this.get("basicUsernameValidation"); - const uniqueUsername = this.get("uniqueUsernameValidation"); + const basicValidation = this.basicUsernameValidation; + const uniqueUsername = this.uniqueUsernameValidation; return uniqueUsername ? uniqueUsername : basicValidation; } }); diff --git a/app/assets/javascripts/discourse/models/action-summary.js.es6 b/app/assets/javascripts/discourse/models/action-summary.js.es6 index 1071f7ddf9b..283a76981da 100644 --- a/app/assets/javascripts/discourse/models/action-summary.js.es6 +++ b/app/assets/javascripts/discourse/models/action-summary.js.es6 @@ -9,18 +9,18 @@ export default RestModel.extend({ removeAction: function() { this.setProperties({ acted: false, - count: this.get("count") - 1, + count: this.count - 1, can_act: true, can_undo: false }); }, togglePromise(post) { - return this.get("acted") ? this.undo(post) : this.act(post); + return this.acted ? this.undo(post) : this.act(post); }, toggle(post) { - if (!this.get("acted")) { + if (!this.acted) { this.act(post); return true; } else { @@ -36,7 +36,7 @@ export default RestModel.extend({ // Mark it as acted this.setProperties({ acted: true, - count: this.get("count") + 1, + count: this.count + 1, can_act: false, can_undo: true }); @@ -45,17 +45,17 @@ export default RestModel.extend({ return ajax("/post_actions", { type: "POST", data: { - id: this.get("flagTopic") ? this.get("flagTopic.id") : post.get("id"), - post_action_type_id: this.get("id"), + id: this.flagTopic ? this.get("flagTopic.id") : post.get("id"), + post_action_type_id: this.id, message: opts.message, is_warning: opts.isWarning, take_action: opts.takeAction, - flag_topic: this.get("flagTopic") ? true : false + flag_topic: this.flagTopic ? true : false }, returnXHR: true }) .then(data => { - if (!this.get("flagTopic")) { + if (!this.flagTopic) { post.updateActionsSummary(data.result); } const remaining = parseInt( @@ -79,7 +79,7 @@ export default RestModel.extend({ // Remove our post action return ajax("/post_actions/" + post.get("id"), { type: "DELETE", - data: { post_action_type_id: this.get("id") } + data: { post_action_type_id: this.id } }).then(result => { post.updateActionsSummary(result); return { acted: false }; diff --git a/app/assets/javascripts/discourse/models/badge-grouping.js.es6 b/app/assets/javascripts/discourse/models/badge-grouping.js.es6 index 5d91e7a2240..2e79188b69f 100644 --- a/app/assets/javascripts/discourse/models/badge-grouping.js.es6 +++ b/app/assets/javascripts/discourse/models/badge-grouping.js.es6 @@ -4,14 +4,14 @@ import RestModel from "discourse/models/rest"; export default RestModel.extend({ @computed("name") i18nNameKey() { - return this.get("name") + return this.name .toLowerCase() .replace(/\s/g, "_"); }, @computed("name") displayName() { - const i18nKey = `badges.badge_grouping.${this.get("i18nNameKey")}.name`; - return I18n.t(i18nKey, { defaultValue: this.get("name") }); + const i18nKey = `badges.badge_grouping.${this.i18nNameKey}.name`; + return I18n.t(i18nKey, { defaultValue: this.name }); } }); diff --git a/app/assets/javascripts/discourse/models/badge.js.es6 b/app/assets/javascripts/discourse/models/badge.js.es6 index fc66d409668..aa3aaa50d97 100644 --- a/app/assets/javascripts/discourse/models/badge.js.es6 +++ b/app/assets/javascripts/discourse/models/badge.js.es6 @@ -8,7 +8,7 @@ const Badge = RestModel.extend({ @computed url() { - return Discourse.getURL(`/badges/${this.get("id")}/${this.get("slug")}`); + return Discourse.getURL(`/badges/${this.id}/${this.slug}`); }, /** @@ -50,9 +50,9 @@ const Badge = RestModel.extend({ requestType = "POST"; const self = this; - if (this.get("id")) { + if (this.id) { // We are updating an existing badge. - url += "/" + this.get("id"); + url += "/" + this.id; requestType = "PUT"; } @@ -76,8 +76,8 @@ const Badge = RestModel.extend({ @returns {Promise} A promise that resolves to the server response **/ destroy: function() { - if (this.get("newBadge")) return Ember.RSVP.resolve(); - return ajax("/admin/badges/" + this.get("id"), { + if (this.newBadge) return Ember.RSVP.resolve(); + return ajax("/admin/badges/" + this.id, { type: "DELETE" }); } diff --git a/app/assets/javascripts/discourse/models/category.js.es6 b/app/assets/javascripts/discourse/models/category.js.es6 index ce8a3c5d008..5b663c48a03 100644 --- a/app/assets/javascripts/discourse/models/category.js.es6 +++ b/app/assets/javascripts/discourse/models/category.js.es6 @@ -7,13 +7,13 @@ import PermissionType from "discourse/models/permission-type"; const Category = RestModel.extend({ @on("init") setupGroupsAndPermissions() { - const availableGroups = this.get("available_groups"); + const availableGroups = this.available_groups; if (!availableGroups) { return; } this.set("availableGroups", availableGroups); - const groupPermissions = this.get("group_permissions"); + const groupPermissions = this.group_permissions; if (groupPermissions) { this.set( "permissions", @@ -74,7 +74,7 @@ const Category = RestModel.extend({ @computed("topic_count") moreTopics(topicCount) { - return topicCount > (this.get("num_featured_topics") || 2); + return topicCount > (this.num_featured_topics || 2); }, @computed("topic_count", "subcategories") @@ -89,76 +89,76 @@ const Category = RestModel.extend({ }, save() { - const id = this.get("id"); + const id = this.id; const url = id ? `/categories/${id}` : "/categories"; return ajax(url, { data: { - name: this.get("name"), - slug: this.get("slug"), - color: this.get("color"), - text_color: this.get("text_color"), - secure: this.get("secure"), + name: this.name, + slug: this.slug, + color: this.color, + text_color: this.text_color, + secure: this.secure, permissions: this._permissionsForUpdate(), - auto_close_hours: this.get("auto_close_hours"), + auto_close_hours: this.auto_close_hours, auto_close_based_on_last_post: this.get( "auto_close_based_on_last_post" ), - position: this.get("position"), - email_in: this.get("email_in"), - email_in_allow_strangers: this.get("email_in_allow_strangers"), - mailinglist_mirror: this.get("mailinglist_mirror"), - parent_category_id: this.get("parent_category_id"), + position: this.position, + email_in: this.email_in, + email_in_allow_strangers: this.email_in_allow_strangers, + mailinglist_mirror: this.mailinglist_mirror, + parent_category_id: this.parent_category_id, uploaded_logo_id: this.get("uploaded_logo.id"), uploaded_background_id: this.get("uploaded_background.id"), - allow_badges: this.get("allow_badges"), - custom_fields: this.get("custom_fields"), - topic_template: this.get("topic_template"), - suppress_from_latest: this.get("suppress_from_latest"), - all_topics_wiki: this.get("all_topics_wiki"), - allowed_tags: this.get("allowed_tags"), - allowed_tag_groups: this.get("allowed_tag_groups"), - allow_global_tags: this.get("allow_global_tags"), - sort_order: this.get("sort_order"), - sort_ascending: this.get("sort_ascending"), - topic_featured_link_allowed: this.get("topic_featured_link_allowed"), - show_subcategory_list: this.get("show_subcategory_list"), - num_featured_topics: this.get("num_featured_topics"), - default_view: this.get("default_view"), - subcategory_list_style: this.get("subcategory_list_style"), - default_top_period: this.get("default_top_period"), - minimum_required_tags: this.get("minimum_required_tags"), + allow_badges: this.allow_badges, + custom_fields: this.custom_fields, + topic_template: this.topic_template, + suppress_from_latest: this.suppress_from_latest, + all_topics_wiki: this.all_topics_wiki, + allowed_tags: this.allowed_tags, + allowed_tag_groups: this.allowed_tag_groups, + allow_global_tags: this.allow_global_tags, + sort_order: this.sort_order, + sort_ascending: this.sort_ascending, + topic_featured_link_allowed: this.topic_featured_link_allowed, + show_subcategory_list: this.show_subcategory_list, + num_featured_topics: this.num_featured_topics, + default_view: this.default_view, + subcategory_list_style: this.subcategory_list_style, + default_top_period: this.default_top_period, + minimum_required_tags: this.minimum_required_tags, navigate_to_first_post_after_read: this.get( "navigate_to_first_post_after_read" ), - search_priority: this.get("search_priority"), - reviewable_by_group_name: this.get("reviewable_by_group_name") + search_priority: this.search_priority, + reviewable_by_group_name: this.reviewable_by_group_name }, type: id ? "PUT" : "POST" }); }, _permissionsForUpdate() { - const permissions = this.get("permissions"); + const permissions = this.permissions; let rval = {}; permissions.forEach(p => (rval[p.group_name] = p.permission.id)); return rval; }, destroy() { - return ajax(`/categories/${this.get("id") || this.get("slug")}`, { + return ajax(`/categories/${this.id || this.slug}`, { type: "DELETE" }); }, addPermission(permission) { - this.get("permissions").addObject(permission); - this.get("availableGroups").removeObject(permission.group_name); + this.permissions.addObject(permission); + this.availableGroups.removeObject(permission.group_name); }, removePermission(permission) { - this.get("permissions").removeObject(permission); - this.get("availableGroups").addObject(permission.group_name); + this.permissions.removeObject(permission); + this.availableGroups.addObject(permission.group_name); }, @computed @@ -180,7 +180,7 @@ const Category = RestModel.extend({ @computed("topics") featuredTopics(topics) { if (topics && topics.length) { - return topics.slice(0, this.get("num_featured_topics") || 2); + return topics.slice(0, this.num_featured_topics || 2); } }, @@ -196,7 +196,7 @@ const Category = RestModel.extend({ setNotification(notification_level) { this.set("notification_level", notification_level); - const url = `/category/${this.get("id")}/notifications`; + const url = `/category/${this.id}/notifications`; return ajax(url, { data: { notification_level }, type: "POST" }); }, diff --git a/app/assets/javascripts/discourse/models/group.js.es6 b/app/assets/javascripts/discourse/models/group.js.es6 index c000b109a58..f017d836ed1 100644 --- a/app/assets/javascripts/discourse/models/group.js.es6 +++ b/app/assets/javascripts/discourse/models/group.js.es6 @@ -37,19 +37,19 @@ const Group = RestModel.extend({ }, findMembers(params) { - if (Ember.isEmpty(this.get("name"))) { + if (Ember.isEmpty(this.name)) { return; } const offset = Math.min( - this.get("user_count"), - Math.max(this.get("offset"), 0) + this.user_count, + Math.max(this.offset, 0) ); return Group.loadMembers( - this.get("name"), + this.name, offset, - this.get("limit"), + this.limit, params ).then(result => { var ownerIds = {}; @@ -72,7 +72,7 @@ const Group = RestModel.extend({ removeOwner(member) { var self = this; - return ajax("/admin/groups/" + this.get("id") + "/owners.json", { + return ajax("/admin/groups/" + this.id + "/owners.json", { type: "DELETE", data: { user_id: member.get("id") } }).then(function() { @@ -82,7 +82,7 @@ const Group = RestModel.extend({ }, removeMember(member, params) { - return ajax("/groups/" + this.get("id") + "/members.json", { + return ajax("/groups/" + this.id + "/members.json", { type: "DELETE", data: { user_id: member.get("id") } }).then(() => { @@ -91,7 +91,7 @@ const Group = RestModel.extend({ }, addMembers(usernames, filter) { - return ajax("/groups/" + this.get("id") + "/members.json", { + return ajax("/groups/" + this.id + "/members.json", { type: "PUT", data: { usernames: usernames } }).then(response => { @@ -104,7 +104,7 @@ const Group = RestModel.extend({ }, addOwners(usernames, filter) { - return ajax(`/admin/groups/${this.get("id")}/owners.json`, { + return ajax(`/admin/groups/${this.id}/owners.json`, { type: "PUT", data: { group: { usernames: usernames } } }).then(response => { @@ -127,15 +127,15 @@ const Group = RestModel.extend({ @computed("flair_bg_color") flairBackgroundHexColor() { - return this.get("flair_bg_color") - ? this.get("flair_bg_color").replace(new RegExp("[^0-9a-fA-F]", "g"), "") + return this.flair_bg_color + ? this.flair_bg_color.replace(new RegExp("[^0-9a-fA-F]", "g"), "") : null; }, @computed("flair_color") flairHexColor() { - return this.get("flair_color") - ? this.get("flair_color").replace(new RegExp("[^0-9a-fA-F]", "g"), "") + return this.flair_color + ? this.flair_color.replace(new RegExp("[^0-9a-fA-F]", "g"), "") : null; }, @@ -151,14 +151,14 @@ const Group = RestModel.extend({ @observes("visibility_level", "canEveryoneMention") _updateAllowMembershipRequests() { - if (this.get("isPrivate") || !this.get("canEveryoneMention")) { + if (this.isPrivate || !this.canEveryoneMention) { this.set("allow_membership_requests", false); } }, @observes("visibility_level") _updatePublic() { - if (this.get("isPrivate")) { + if (this.isPrivate) { this.set("public", false); this.set("allow_membership_requests", false); } @@ -166,33 +166,33 @@ const Group = RestModel.extend({ asJSON() { const attrs = { - name: this.get("name"), - mentionable_level: this.get("mentionable_level"), - messageable_level: this.get("messageable_level"), - visibility_level: this.get("visibility_level"), - automatic_membership_email_domains: this.get("emailDomains"), + name: this.name, + mentionable_level: this.mentionable_level, + messageable_level: this.messageable_level, + visibility_level: this.visibility_level, + automatic_membership_email_domains: this.emailDomains, automatic_membership_retroactive: !!this.get( "automatic_membership_retroactive" ), - title: this.get("title"), - primary_group: !!this.get("primary_group"), - grant_trust_level: this.get("grant_trust_level"), - incoming_email: this.get("incoming_email"), - flair_url: this.get("flair_url"), - flair_bg_color: this.get("flairBackgroundHexColor"), - flair_color: this.get("flairHexColor"), - bio_raw: this.get("bio_raw"), - public_admission: this.get("public_admission"), - public_exit: this.get("public_exit"), - allow_membership_requests: this.get("allow_membership_requests"), - full_name: this.get("full_name"), - default_notification_level: this.get("default_notification_level"), - membership_request_template: this.get("membership_request_template") + title: this.title, + primary_group: !!this.primary_group, + grant_trust_level: this.grant_trust_level, + incoming_email: this.incoming_email, + flair_url: this.flair_url, + flair_bg_color: this.flairBackgroundHexColor, + flair_color: this.flairHexColor, + bio_raw: this.bio_raw, + public_admission: this.public_admission, + public_exit: this.public_exit, + allow_membership_requests: this.allow_membership_requests, + full_name: this.full_name, + default_notification_level: this.default_notification_level, + membership_request_template: this.membership_request_template }; - if (!this.get("id")) { - attrs["usernames"] = this.get("usernames"); - attrs["owner_usernames"] = this.get("ownerUsernames"); + if (!this.id) { + attrs["usernames"] = this.usernames; + attrs["owner_usernames"] = this.ownerUsernames; } return attrs; @@ -214,21 +214,21 @@ const Group = RestModel.extend({ }, save() { - return ajax(`/groups/${this.get("id")}`, { + return ajax(`/groups/${this.id}`, { type: "PUT", data: { group: this.asJSON() } }); }, destroy() { - if (!this.get("id")) { + if (!this.id) { return; } - return ajax("/admin/groups/" + this.get("id"), { type: "DELETE" }); + return ajax("/admin/groups/" + this.id, { type: "DELETE" }); }, findLogs(offset, filters) { - return ajax(`/groups/${this.get("name")}/logs.json`, { + return ajax(`/groups/${this.name}/logs.json`, { data: { offset, filters } }).then(results => { return Ember.Object.create({ @@ -251,7 +251,7 @@ const Group = RestModel.extend({ data.category_id = parseInt(opts.categoryId); } - return ajax(`/groups/${this.get("name")}/${type}.json`, { data }).then( + return ajax(`/groups/${this.name}/${type}.json`, { data }).then( posts => { return posts.map(p => { p.user = User.create(p.user); @@ -265,14 +265,14 @@ const Group = RestModel.extend({ setNotification(notification_level, userId) { this.set("group_user.notification_level", notification_level); - return ajax(`/groups/${this.get("name")}/notifications`, { + return ajax(`/groups/${this.name}/notifications`, { data: { notification_level, user_id: userId }, type: "POST" }); }, requestMembership(reason) { - return ajax(`/groups/${this.get("name")}/request_membership`, { + return ajax(`/groups/${this.name}/request_membership`, { type: "POST", data: { reason: reason } }); diff --git a/app/assets/javascripts/discourse/models/invite.js.es6 b/app/assets/javascripts/discourse/models/invite.js.es6 index 6775f9d10ad..c5ab2d50a72 100644 --- a/app/assets/javascripts/discourse/models/invite.js.es6 +++ b/app/assets/javascripts/discourse/models/invite.js.es6 @@ -6,7 +6,7 @@ const Invite = Discourse.Model.extend({ rescind() { ajax("/invites", { type: "DELETE", - data: { email: this.get("email") } + data: { email: this.email } }); this.set("rescinded", true); }, @@ -15,7 +15,7 @@ const Invite = Discourse.Model.extend({ const self = this; return ajax("/invites/reinvite", { type: "POST", - data: { email: this.get("email") } + data: { email: this.email } }) .then(function() { self.set("reinvited", true); diff --git a/app/assets/javascripts/discourse/models/login-method.js.es6 b/app/assets/javascripts/discourse/models/login-method.js.es6 index b5ad2709006..001671dcc01 100644 --- a/app/assets/javascripts/discourse/models/login-method.js.es6 +++ b/app/assets/javascripts/discourse/models/login-method.js.es6 @@ -4,34 +4,34 @@ const LoginMethod = Ember.Object.extend({ @computed title() { return ( - this.get("title_override") || I18n.t(`login.${this.get("name")}.title`) + this.title_override || I18n.t(`login.${this.name}.title`) ); }, @computed prettyName() { return ( - this.get("pretty_name_override") || - I18n.t(`login.${this.get("name")}.name`) + this.pretty_name_override || + I18n.t(`login.${this.name}.name`) ); }, @computed message() { return ( - this.get("message_override") || - I18n.t("login." + this.get("name") + ".message") + this.message_override || + I18n.t("login." + this.name + ".message") ); }, doLogin({ reconnect = false, fullScreenLogin = true } = {}) { - const name = this.get("name"); - const customLogin = this.get("customLogin"); + const name = this.name; + const customLogin = this.customLogin; if (customLogin) { customLogin(); } else { - let authUrl = this.get("custom_url") || Discourse.getURL("/auth/" + name); + let authUrl = this.custom_url || Discourse.getURL("/auth/" + name); if (reconnect) { authUrl += "?reconnect=true"; @@ -42,11 +42,11 @@ const LoginMethod = Ember.Object.extend({ window.location = authUrl; } else { this.set("authenticate", name); - const left = this.get("lastX") - 400; - const top = this.get("lastY") - 200; + const left = this.lastX - 400; + const top = this.lastY - 200; - const height = this.get("frame_height") || 400; - const width = this.get("frame_width") || 800; + const height = this.frame_height || 400; + const width = this.frame_width || 800; if (name === "facebook") { authUrl += authUrl.includes("?") ? "&" : "?"; diff --git a/app/assets/javascripts/discourse/models/nav-item.js.es6 b/app/assets/javascripts/discourse/models/nav-item.js.es6 index 0739efe27ac..64a705de898 100644 --- a/app/assets/javascripts/discourse/models/nav-item.js.es6 +++ b/app/assets/javascripts/discourse/models/nav-item.js.es6 @@ -93,7 +93,7 @@ const NavItem = Discourse.Model.extend({ @computed("name", "category", "topicTrackingState.messageCount") count(name, category) { - const state = this.get("topicTrackingState"); + const state = this.topicTrackingState; if (state) { return state.lookupCount(name, category); } diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6 index 41889985317..2812693388f 100644 --- a/app/assets/javascripts/discourse/models/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/post-stream.js.es6 @@ -82,7 +82,7 @@ export default RestModel.extend({ if (!hasLoadedData) { return false; } - return !!this.get("posts").findBy("id", firstPostId); + return !!this.posts.findBy("id", firstPostId); }, firstPostNotLoaded: Ember.computed.not("firstPostPresent"), @@ -109,7 +109,7 @@ export default RestModel.extend({ return true; } - return !!this.get("posts").findBy("id", lastPostId); + return !!this.posts.findBy("id", lastPostId); }, lastPostNotLoaded: Ember.computed.not("loadedAllPosts"), @@ -125,7 +125,7 @@ export default RestModel.extend({ result.filter = "summary"; } - const userFilters = this.get("userFilters"); + const userFilters = this.userFilters; if (!Ember.isEmpty(userFilters)) { result.username_filters = userFilters.join(","); } @@ -135,7 +135,7 @@ export default RestModel.extend({ @computed("streamFilters.[]", "topic.posts_count", "posts.length") hasNoFilters() { - const streamFilters = this.get("streamFilters"); + const streamFilters = this.streamFilters; return !( streamFilters && (streamFilters.filter === "summary" || streamFilters.username_filters) @@ -149,13 +149,13 @@ export default RestModel.extend({ @computed("posts.[]", "stream.[]") previousWindow() { // If we can't find the last post loaded, bail - const firstPost = _.first(this.get("posts")); + const firstPost = _.first(this.posts); if (!firstPost) { return []; } // Find the index of the last post loaded, if not found, bail - const stream = this.get("stream"); + const stream = this.stream; const firstIndex = this.indexOf(firstPost); if (firstIndex === -1) { return []; @@ -180,12 +180,12 @@ export default RestModel.extend({ } // Find the index of the last post loaded, if not found, bail - const stream = this.get("stream"); + const stream = this.stream; const lastIndex = this.indexOf(lastLoadedPost); if (lastIndex === -1) { return []; } - if (lastIndex + 1 >= this.get("highest_post_number")) { + if (lastIndex + 1 >= this.highest_post_number) { return []; } @@ -198,27 +198,27 @@ export default RestModel.extend({ cancelFilter() { this.set("summary", false); - this.get("userFilters").clear(); + this.userFilters.clear(); }, toggleSummary() { - this.get("userFilters").clear(); + this.userFilters.clear(); this.toggleProperty("summary"); const opts = {}; - if (!this.get("summary")) { + if (!this.summary) { opts.filter = "none"; } return this.refresh(opts).then(() => { - if (this.get("summary")) { + if (this.summary) { this.jumpToSecondVisible(); } }); }, jumpToSecondVisible() { - const posts = this.get("posts"); + const posts = this.posts; if (posts.length > 1) { const secondPostNum = posts[1].get("post_number"); DiscourseURL.jumpToPost(secondPostNum); @@ -227,7 +227,7 @@ export default RestModel.extend({ // Filter the stream to a particular user. toggleParticipant(username) { - const userFilters = this.get("userFilters"); + const userFilters = this.userFilters; this.set("summary", false); let jump = false; @@ -257,13 +257,13 @@ export default RestModel.extend({ delete opts.cancelSummary; } - const topic = this.get("topic"); + const topic = this.topic; // Do we already have the post in our list of posts? Jump there. if (opts.forceLoad) { this.set("loaded", false); } else { - const postWeWant = this.get("posts").findBy("post_number", opts.nearPost); + const postWeWant = this.posts.findBy("post_number", opts.nearPost); if (postWeWant) { return Ember.RSVP.resolve(); } @@ -273,7 +273,7 @@ export default RestModel.extend({ this.set("loadingFilter", true); this.set("loadingNearPost", opts.nearPost); - opts = _.merge(opts, this.get("streamFilters")); + opts = _.merge(opts, this.streamFilters); // Request a topicView return loadTopicView(topic, opts) @@ -297,9 +297,9 @@ export default RestModel.extend({ // Fill in a gap of posts before a particular post fillGapBefore(post, gap) { const postId = post.get("id"), - stream = this.get("stream"), + stream = this.stream, idx = stream.indexOf(postId), - currentPosts = this.get("posts"); + currentPosts = this.posts; if (idx !== -1) { // Insert the gap at the appropriate place @@ -317,8 +317,8 @@ export default RestModel.extend({ }); delete this.get("gaps.before")[postId]; - this.get("stream").arrayContentDidChange(); - this.get("postsWithPlaceholders").arrayContentDidChange( + this.stream.arrayContentDidChange(); + this.postsWithPlaceholders.arrayContentDidChange( origIdx, 0, posts.length @@ -333,14 +333,14 @@ export default RestModel.extend({ // Fill in a gap of posts after a particular post fillGapAfter(post, gap) { const postId = post.get("id"), - stream = this.get("stream"), + stream = this.stream, idx = stream.indexOf(postId); if (idx !== -1) { stream.pushObjects(gap); return this.appendMore().then(() => { delete this.get("gaps.after")[postId]; - this.get("stream").arrayContentDidChange(); + this.stream.arrayContentDidChange(); }); } return Ember.RSVP.resolve(); @@ -349,13 +349,13 @@ export default RestModel.extend({ // Appends the next window of posts to the stream. Call it when scrolling downwards. appendMore() { // Make sure we can append more posts - if (!this.get("canAppendMore")) { + if (!this.canAppendMore) { return Ember.RSVP.resolve(); } - const postsWithPlaceholders = this.get("postsWithPlaceholders"); + const postsWithPlaceholders = this.postsWithPlaceholders; - if (this.get("isMegaTopic")) { + if (this.isMegaTopic) { this.set("loadingBelow", true); const fakePostIds = _.range(-1, -this.get("topic.chunk_size"), -1); @@ -372,7 +372,7 @@ export default RestModel.extend({ this.set("loadingBelow", false); }); } else { - const postIds = this.get("nextWindow"); + const postIds = this.nextWindow; if (Ember.isEmpty(postIds)) return Ember.RSVP.resolve(); this.set("loadingBelow", true); postsWithPlaceholders.appending(postIds); @@ -392,11 +392,11 @@ export default RestModel.extend({ // Prepend the previous window of posts to the stream. Call it when scrolling upwards. prependMore() { // Make sure we can append more posts - if (!this.get("canPrependMore")) { + if (!this.canPrependMore) { return Ember.RSVP.resolve(); } - if (this.get("isMegaTopic")) { + if (this.isMegaTopic) { this.set("loadingAbove", true); let prependedIds = []; @@ -408,12 +408,12 @@ export default RestModel.extend({ prependedIds.push(p.get("id")); } ).finally(() => { - const postsWithPlaceholders = this.get("postsWithPlaceholders"); + const postsWithPlaceholders = this.postsWithPlaceholders; postsWithPlaceholders.finishedPrepending(prependedIds); this.set("loadingAbove", false); }); } else { - const postIds = this.get("previousWindow"); + const postIds = this.previousWindow; if (Ember.isEmpty(postIds)) return Ember.RSVP.resolve(); this.set("loadingAbove", true); @@ -422,7 +422,7 @@ export default RestModel.extend({ posts.forEach(p => this.prependPost(p)); }) .finally(() => { - const postsWithPlaceholders = this.get("postsWithPlaceholders"); + const postsWithPlaceholders = this.postsWithPlaceholders; postsWithPlaceholders.finishedPrepending(postIds); this.set("loadingAbove", false); }); @@ -436,13 +436,13 @@ export default RestModel.extend({ **/ stagePost(post, user) { // We can't stage two posts simultaneously - if (this.get("stagingPost")) { + if (this.stagingPost) { return "alreadyStaging"; } this.set("stagingPost", true); - const topic = this.get("topic"); + const topic = this.topic; topic.setProperties({ posts_count: (topic.get("posts_count") || 0) + 1, last_posted_at: new Date(), @@ -458,9 +458,9 @@ export default RestModel.extend({ }); // If we're at the end of the stream, add the post - if (this.get("loadedAllPosts")) { + if (this.loadedAllPosts) { this.appendPost(post); - this.get("stream").addObject(post.get("id")); + this.stream.addObject(post.get("id")); return "staged"; } @@ -470,13 +470,13 @@ export default RestModel.extend({ // Commit the post we staged. Call this after a save succeeds. commitPost(post) { if (this.get("topic.id") === post.get("topic_id")) { - if (this.get("loadedAllPosts")) { + if (this.loadedAllPosts) { this.appendPost(post); - this.get("stream").addObject(post.get("id")); + this.stream.addObject(post.get("id")); } } - this.get("stream").removeObject(-1); + this.stream.removeObject(-1); this._identityMap[-1] = null; this.set("stagingPost", false); }, @@ -486,13 +486,13 @@ export default RestModel.extend({ state we changed. **/ undoPost(post) { - this.get("stream").removeObject(-1); - this.get("postsWithPlaceholders").removePost(() => + this.stream.removeObject(-1); + this.postsWithPlaceholders.removePost(() => this.posts.removeObject(post) ); this._identityMap[-1] = null; - const topic = this.get("topic"); + const topic = this.topic; this.set("stagingPost", false); topic.setProperties({ @@ -506,7 +506,7 @@ export default RestModel.extend({ prependPost(post) { const stored = this.storePost(post); if (stored) { - const posts = this.get("posts"); + const posts = this.posts; posts.unshiftObject(stored); } @@ -516,11 +516,11 @@ export default RestModel.extend({ appendPost(post) { const stored = this.storePost(post); if (stored) { - const posts = this.get("posts"); + const posts = this.posts; if (!posts.includes(stored)) { - if (!this.get("loadingBelow")) { - this.get("postsWithPlaceholders").appendPost(() => + if (!this.loadingBelow) { + this.postsWithPlaceholders.appendPost(() => posts.pushObject(stored) ); } else { @@ -540,12 +540,12 @@ export default RestModel.extend({ return; } - this.get("postsWithPlaceholders").refreshAll(() => { - const allPosts = this.get("posts"); + this.postsWithPlaceholders.refreshAll(() => { + const allPosts = this.posts; const postIds = posts.map(p => p.get("id")); const identityMap = this._identityMap; - this.get("stream").removeObjects(postIds); + this.stream.removeObjects(postIds); allPosts.removeObjects(posts); postIds.forEach(id => delete identityMap[id]); }); @@ -601,14 +601,14 @@ export default RestModel.extend({ } // We only trigger if there are no filters active - if (!this.get("hasNoFilters")) { + if (!this.hasNoFilters) { return resolved; } - const loadedAllPosts = this.get("loadedAllPosts"); + const loadedAllPosts = this.loadedAllPosts; - if (this.get("stream").indexOf(postId) === -1) { - this.get("stream").addObject(postId); + if (this.stream.indexOf(postId) === -1) { + this.stream.addObject(postId); if (loadedAllPosts) { this.set("loadingLastPost", true); return this.findPostsByIds([postId]) @@ -636,8 +636,8 @@ export default RestModel.extend({ return ajax(url).then(p => { const post = store.createRecord("post", p); - const stream = this.get("stream"); - const posts = this.get("posts"); + const stream = this.stream; + const posts = this.posts; this.storePost(post); // we need to zip this into the stream @@ -658,7 +658,7 @@ export default RestModel.extend({ }); if (index < posts.length) { - this.get("postsWithPlaceholders").refreshAll(() => { + this.postsWithPlaceholders.refreshAll(() => { posts.insertAt(index, post); }); } else { @@ -712,11 +712,11 @@ export default RestModel.extend({ }, postForPostNumber(postNumber) { - if (!this.get("hasPosts")) { + if (!this.hasPosts) { return; } - return this.get("posts").find(p => { + return this.posts.find(p => { return p.get("post_number") === postNumber; }); }, @@ -727,12 +727,12 @@ export default RestModel.extend({ This allows us to set the progress bar with the correct number. **/ closestPostForPostNumber(postNumber) { - if (!this.get("hasPosts")) { + if (!this.hasPosts) { return; } let closest = null; - this.get("posts").forEach(p => { + this.posts.forEach(p => { if (!closest) { closest = p; return; @@ -757,9 +757,9 @@ export default RestModel.extend({ // Get the index in the stream of a post id. (Use this for the topic progress bar.) progressIndexOfPostId(post) { const postId = post.get("id"); - const index = this.get("stream").indexOf(postId); + const index = this.stream.indexOf(postId); - if (this.get("isMegaTopic")) { + if (this.isMegaTopic) { return post.get("post_number"); } else { return index + 1; @@ -772,12 +772,12 @@ export default RestModel.extend({ This allows us to set the progress bar with the correct number. **/ closestPostNumberFor(postNumber) { - if (!this.get("hasPosts")) { + if (!this.hasPosts) { return; } let closest = null; - this.get("posts").forEach(p => { + this.posts.forEach(p => { if (closest === postNumber) { return; } @@ -797,7 +797,7 @@ export default RestModel.extend({ }, closestDaysAgoFor(postNumber) { - const timelineLookup = this.get("timelineLookup") || []; + const timelineLookup = this.timelineLookup || []; let low = 0; let high = timelineLookup.length - 1; @@ -821,7 +821,7 @@ export default RestModel.extend({ // Find a postId for a postNumber, respecting gaps findPostIdForPostNumber(postNumber) { - const stream = this.get("stream"), + const stream = this.stream, beforeLookup = this.get("gaps.before"), streamLength = stream.length; @@ -850,9 +850,9 @@ export default RestModel.extend({ }, updateFromJson(postStreamData) { - const posts = this.get("posts"); + const posts = this.posts; - const postsWithPlaceholders = this.get("postsWithPlaceholders"); + const postsWithPlaceholders = this.postsWithPlaceholders; postsWithPlaceholders.clear(() => posts.clear()); this.set("gaps", null); @@ -900,7 +900,7 @@ export default RestModel.extend({ return existing; } - post.set("topic", this.get("topic")); + post.set("topic", this.topic); this._identityMap[post.get("id")] = post; } return post; @@ -916,7 +916,7 @@ export default RestModel.extend({ include_suggested: includeSuggested }; - data = _.merge(data, this.get("streamFilters")); + data = _.merge(data, this.streamFilters); const store = this.store; return ajax(url, { data }).then(result => { @@ -974,7 +974,7 @@ export default RestModel.extend({ backfillExcerpts(streamPosition) { this._excerpts = this._excerpts || []; - const stream = this.get("stream"); + const stream = this.stream; this._excerpts.loadNext = streamPosition; @@ -1020,11 +1020,11 @@ export default RestModel.extend({ }, excerpt(streamPosition) { - if (this.get("isMegaTopic")) { + if (this.isMegaTopic) { return new Ember.RSVP.Promise(resolve => resolve("")); } - const stream = this.get("stream"); + const stream = this.stream; return new Ember.RSVP.Promise((resolve, reject) => { let excerpt = this._excerpts && this._excerpts[stream[streamPosition]]; @@ -1043,7 +1043,7 @@ export default RestModel.extend({ }, indexOf(post) { - return this.get("stream").indexOf(post.get("id")); + return this.stream.indexOf(post.get("id")); }, // Handles an error loading a topic based on a HTTP status code. Updates @@ -1051,7 +1051,7 @@ export default RestModel.extend({ errorLoading(result) { const status = result.jqXHR.status; - const topic = this.get("topic"); + const topic = this.topic; this.set("loadingFilter", false); topic.set("errorLoading", true); diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index b1a3d893168..6b431edec94 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -22,7 +22,7 @@ const Post = RestModel.extend({ const user = Discourse.User.current(); const userSuffix = user ? "?u=" + user.get("username_lower") : ""; - if (this.get("firstPost")) { + if (this.firstPost) { return this.get("topic.url") + userSuffix; } else { return url + userSuffix; @@ -57,7 +57,7 @@ const Post = RestModel.extend({ @computed("post_number", "topic_id", "topic.slug") url(postNr, topicId, slug) { return postUrl( - slug || this.get("topic_slug"), + slug || this.topic_slug, topicId || this.get("topic.id"), postNr ); @@ -80,7 +80,7 @@ const Post = RestModel.extend({ const data = {}; data[field] = value; - return ajax(`/posts/${this.get("id")}/${field}`, { type: "PUT", data }) + return ajax(`/posts/${this.id}/${field}`, { type: "PUT", data }) .then(() => { this.set(field, value); }) @@ -89,9 +89,9 @@ const Post = RestModel.extend({ @computed("link_counts.@each.internal") internalLinks() { - if (Ember.isEmpty(this.get("link_counts"))) return null; + if (Ember.isEmpty(this.link_counts)) return null; - return this.get("link_counts") + return this.link_counts .filterBy("internal") .filterBy("title"); }, @@ -117,18 +117,18 @@ const Post = RestModel.extend({ updateProperties() { return { - post: { raw: this.get("raw"), edit_reason: this.get("editReason") }, - image_sizes: this.get("imageSizes") + post: { raw: this.raw, edit_reason: this.editReason }, + image_sizes: this.imageSizes }; }, createProperties() { // composer only used once, defer the dependency const data = this.getProperties(Composer.serializedFieldsForCreate()); - data.reply_to_post_number = this.get("reply_to_post_number"); - data.image_sizes = this.get("imageSizes"); + data.reply_to_post_number = this.reply_to_post_number; + data.image_sizes = this.imageSizes; - const metaData = this.get("metaData"); + const metaData = this.metaData; // Put the metaData into the request if (metaData) { @@ -143,7 +143,7 @@ const Post = RestModel.extend({ // Expands the first post's content, if embedded and shortened. expand() { - return ajax(`/posts/${this.get("id")}/expand-embed`).then(post => { + return ajax(`/posts/${this.id}/expand-embed`).then(post => { this.set( "cooked", ` ` @@ -167,7 +167,7 @@ const Post = RestModel.extend({ can_delete: false }); - return ajax(`/posts/${this.get("id")}/recover`, { + return ajax(`/posts/${this.id}/recover`, { type: "PUT", cache: false }) @@ -192,7 +192,7 @@ const Post = RestModel.extend({ **/ setDeletedState(deletedBy) { let promise; - this.set("oldCooked", this.get("cooked")); + this.set("oldCooked", this.cooked); // Moderators can delete posts. Users can only trigger a deleted at message, unless delete_removed_posts_after is 0. if ( @@ -207,7 +207,7 @@ const Post = RestModel.extend({ }); } else { const key = - this.get("post_number") === 1 + this.post_number === 1 ? "topic.deleted_by_author" : "post.deleted_by_author"; promise = cookAsync( @@ -218,7 +218,7 @@ const Post = RestModel.extend({ this.setProperties({ cooked: cooked, can_delete: false, - version: this.get("version") + 1, + version: this.version + 1, can_recover: true, can_edit: false, user_deleted: true @@ -235,12 +235,12 @@ const Post = RestModel.extend({ failed on the server. **/ undoDeleteState() { - if (this.get("oldCooked")) { + if (this.oldCooked) { this.setProperties({ deleted_at: null, deleted_by: null, - cooked: this.get("oldCooked"), - version: this.get("version") - 1, + cooked: this.oldCooked, + version: this.version - 1, can_recover: false, can_delete: true, user_deleted: false @@ -250,7 +250,7 @@ const Post = RestModel.extend({ destroy(deletedBy) { return this.setDeletedState(deletedBy).then(() => { - return ajax("/posts/" + this.get("id"), { + return ajax("/posts/" + this.id, { data: { context: window.location.pathname }, type: "DELETE" }); @@ -291,17 +291,17 @@ const Post = RestModel.extend({ }, expandHidden() { - return ajax("/posts/" + this.get("id") + "/cooked.json").then(result => { + return ajax("/posts/" + this.id + "/cooked.json").then(result => { this.setProperties({ cooked: result.cooked, cooked_hidden: false }); }); }, rebake() { - return ajax("/posts/" + this.get("id") + "/rebake", { type: "PUT" }); + return ajax("/posts/" + this.id + "/rebake", { type: "PUT" }); }, unhide() { - return ajax("/posts/" + this.get("id") + "/unhide", { type: "PUT" }); + return ajax("/posts/" + this.id + "/unhide", { type: "PUT" }); }, toggleBookmark() { @@ -310,14 +310,14 @@ const Post = RestModel.extend({ this.toggleProperty("bookmarked"); - if (this.get("bookmarked") && !this.get("topic.bookmarked")) { + if (this.bookmarked && !this.get("topic.bookmarked")) { this.set("topic.bookmarked", true); bookmarkedTopic = true; } // need to wait to hear back from server (stuff may not be loaded) - return Discourse.Post.updateBookmark(this.get("id"), this.get("bookmarked")) + return Discourse.Post.updateBookmark(this.id, this.bookmarked) .then(function(result) { self.set("topic.bookmarked", result.topic_bookmarked); }) @@ -331,14 +331,14 @@ const Post = RestModel.extend({ }, updateActionsSummary(json) { - if (json && json.id === this.get("id")) { + if (json && json.id === this.id) { json = Post.munge(json); this.set("actions_summary", json.actions_summary); } }, revertToRevision(version) { - return ajax(`/posts/${this.get("id")}/revisions/${version}/revert`, { + return ajax(`/posts/${this.id}/revisions/${version}/revert`, { type: "PUT" }); } diff --git a/app/assets/javascripts/discourse/models/rest.js.es6 b/app/assets/javascripts/discourse/models/rest.js.es6 index bc78826cbf4..6f937d02b98 100644 --- a/app/assets/javascripts/discourse/models/rest.js.es6 +++ b/app/assets/javascripts/discourse/models/rest.js.es6 @@ -7,19 +7,19 @@ const RestModel = Ember.Object.extend({ afterUpdate() {}, update(props) { - if (this.get("isSaving")) { + if (this.isSaving) { return Ember.RSVP.reject(); } props = props || this.updateProperties(); - const type = this.get("__type"), - store = this.get("store"); + const type = this.__type, + store = this.store; const self = this; self.set("isSaving", true); return store - .update(type, this.get("id"), props) + .update(type, this.id, props) .then(function(res) { const payload = self.__munge(res.payload || res.responseJson); @@ -39,7 +39,7 @@ const RestModel = Ember.Object.extend({ }, _saveNew(props) { - if (this.get("isSaving")) { + if (this.isSaving) { return Ember.RSVP.reject(); } @@ -47,8 +47,8 @@ const RestModel = Ember.Object.extend({ this.beforeCreate(props); - const type = this.get("__type"), - store = this.get("store"), + const type = this.__type, + store = this.store, adapter = store.adapterFor(type); const self = this; @@ -80,11 +80,11 @@ const RestModel = Ember.Object.extend({ }, save(props) { - return this.get("isNew") ? this._saveNew(props) : this.update(props); + return this.isNew ? this._saveNew(props) : this.update(props); }, destroyRecord() { - const type = this.get("__type"); + const type = this.__type; return this.store.destroyRecord(type, this); } }); diff --git a/app/assets/javascripts/discourse/models/result-set.js.es6 b/app/assets/javascripts/discourse/models/result-set.js.es6 index 91101bce9d5..dc9f1f9ec48 100644 --- a/app/assets/javascripts/discourse/models/result-set.js.es6 +++ b/app/assets/javascripts/discourse/models/result-set.js.es6 @@ -20,17 +20,17 @@ export default Ember.ArrayProxy.extend({ }, loadMore() { - const loadMoreUrl = this.get("loadMoreUrl"); + const loadMoreUrl = this.loadMoreUrl; if (!loadMoreUrl) { return; } - const totalRows = this.get("totalRows"); - if (this.get("length") < totalRows && !this.get("loadingMore")) { + const totalRows = this.totalRows; + if (this.length < totalRows && !this.loadingMore) { this.set("loadingMore", true); return this.store - .appendResults(this, this.get("__type"), loadMoreUrl) + .appendResults(this, this.__type, loadMoreUrl) .finally(() => this.set("loadingMore", false)); } @@ -38,18 +38,18 @@ export default Ember.ArrayProxy.extend({ }, refresh() { - if (this.get("refreshing")) { + if (this.refreshing) { return; } - const refreshUrl = this.get("refreshUrl"); + const refreshUrl = this.refreshUrl; if (!refreshUrl) { return; } this.set("refreshing", true); return this.store - .refreshResults(this, this.get("__type"), refreshUrl) + .refreshResults(this, this.__type, refreshUrl) .finally(() => this.set("refreshing", false)); } }); diff --git a/app/assets/javascripts/discourse/models/reviewable.js.es6 b/app/assets/javascripts/discourse/models/reviewable.js.es6 index 36fb0b0d5fe..3c1869f0e43 100644 --- a/app/assets/javascripts/discourse/models/reviewable.js.es6 +++ b/app/assets/javascripts/discourse/models/reviewable.js.es6 @@ -25,12 +25,12 @@ export default RestModel.extend({ let adapter = this.store.adapterFor("reviewable"); return ajax( - `/review/${this.get("id")}?version=${this.get("version")}`, + `/review/${this.id}?version=${this.version}`, adapter.getPayload("PUT", { reviewable: updates }) ).then(updated => { updated.payload = Object.assign( {}, - this.get("payload") || {}, + this.payload || {}, updated.payload || {} ); diff --git a/app/assets/javascripts/discourse/models/site.js.es6 b/app/assets/javascripts/discourse/models/site.js.es6 index 87bde462702..246aaec63e4 100644 --- a/app/assets/javascripts/discourse/models/site.js.es6 +++ b/app/assets/javascripts/discourse/models/site.js.es6 @@ -19,7 +19,7 @@ const Site = RestModel.extend({ @computed("post_action_types.[]") flagTypes() { - const postActionTypes = this.get("post_action_types"); + const postActionTypes = this.post_action_types; if (!postActionTypes) return []; return postActionTypes.filterBy("is_flag", true); }, @@ -30,7 +30,7 @@ const Site = RestModel.extend({ collectUserFields(fields) { fields = fields || {}; - let siteFields = this.get("user_fields"); + let siteFields = this.user_fields; if (!Ember.isEmpty(siteFields)) { return siteFields.map(f => { @@ -79,8 +79,8 @@ const Site = RestModel.extend({ @computed categoriesList() { return this.siteSettings.fixed_category_positions - ? this.get("categories") - : this.get("sortedCategories"); + ? this.categories + : this.sortedCategories; }, postActionTypeById(id) { @@ -92,16 +92,16 @@ const Site = RestModel.extend({ }, removeCategory(id) { - const categories = this.get("categories"); + const categories = this.categories; const existingCategory = categories.findBy("id", id); if (existingCategory) { categories.removeObject(existingCategory); - delete this.get("categoriesById").categoryId; + delete this.categoriesById.categoryId; } }, updateCategory(newCategory) { - const categories = this.get("categories"); + const categories = this.categories; const categoryId = Ember.get(newCategory, "id"); const existingCategory = categories.findBy("id", categoryId); @@ -116,7 +116,7 @@ const Site = RestModel.extend({ // TODO insert in right order? newCategory = this.store.createRecord("category", newCategory); categories.pushObject(newCategory); - this.get("categoriesById")[categoryId] = newCategory; + this.categoriesById[categoryId] = newCategory; } } }); diff --git a/app/assets/javascripts/discourse/models/tag-group.js.es6 b/app/assets/javascripts/discourse/models/tag-group.js.es6 index 4c46aa6f9aa..6d0579a1b96 100644 --- a/app/assets/javascripts/discourse/models/tag-group.js.es6 +++ b/app/assets/javascripts/discourse/models/tag-group.js.es6 @@ -46,8 +46,8 @@ export default RestModel.extend({ this.set("savingStatus", I18n.t("saving")); this.set("saving", true); - const isNew = this.get("id") === "new"; - const url = isNew ? "/tag_groups" : `/tag_groups/${this.get("id")}`; + const isNew = this.id === "new"; + const url = isNew ? "/tag_groups" : `/tag_groups/${this.id}`; const data = this.getProperties( "name", "tag_names", @@ -72,6 +72,6 @@ export default RestModel.extend({ }, destroy() { - return ajax(`/tag_groups/${this.get("id")}`, { type: "DELETE" }); + return ajax(`/tag_groups/${this.id}`, { type: "DELETE" }); } }); diff --git a/app/assets/javascripts/discourse/models/topic-details.js.es6 b/app/assets/javascripts/discourse/models/topic-details.js.es6 index 01b31d5ddd1..4a8c2f05f90 100644 --- a/app/assets/javascripts/discourse/models/topic-details.js.es6 +++ b/app/assets/javascripts/discourse/models/topic-details.js.es6 @@ -12,7 +12,7 @@ const TopicDetails = RestModel.extend({ loaded: false, updateFromJson(details) { - const topic = this.get("topic"); + const topic = this.topic; if (details.allowed_users) { details.allowed_users = details.allowed_users.map(function(u) { @@ -69,7 +69,7 @@ const TopicDetails = RestModel.extend({ }, removeAllowedGroup(group) { - const groups = this.get("allowed_groups"); + const groups = this.allowed_groups; const name = group.name; return ajax("/t/" + this.get("topic.id") + "/remove-allowed-group", { @@ -81,7 +81,7 @@ const TopicDetails = RestModel.extend({ }, removeAllowedUser(user) { - const users = this.get("allowed_users"); + const users = this.allowed_users; const username = user.get("username"); return ajax("/t/" + this.get("topic.id") + "/remove-allowed-user", { diff --git a/app/assets/javascripts/discourse/models/topic-list.js.es6 b/app/assets/javascripts/discourse/models/topic-list.js.es6 index 48964766ec2..9ed73dadca9 100644 --- a/app/assets/javascripts/discourse/models/topic-list.js.es6 +++ b/app/assets/javascripts/discourse/models/topic-list.js.es6 @@ -25,7 +25,7 @@ const TopicList = RestModel.extend({ forEachNew(topics, callback) { const topicIds = []; - this.get("topics").forEach(topic => (topicIds[topic.get("id")] = true)); + this.topics.forEach(topic => (topicIds[topic.get("id")] = true)); topics.forEach(topic => { if (!topicIds[topic.id]) { @@ -35,7 +35,7 @@ const TopicList = RestModel.extend({ }, refreshSort(order, ascending) { - let params = this.get("params") || {}; + let params = this.params || {}; if (params.q) { // search is unique, nothing else allowed with it @@ -49,11 +49,11 @@ const TopicList = RestModel.extend({ }, loadMore() { - if (this.get("loadingMore")) { + if (this.loadingMore) { return Ember.RSVP.resolve(); } - let moreUrl = this.get("more_topics_url"); + let moreUrl = this.more_topics_url; if (moreUrl) { let [url, params] = moreUrl.split("?"); @@ -103,7 +103,7 @@ const TopicList = RestModel.extend({ // loads topics with these ids "before" the current topics loadBefore(topic_ids, storeInSession) { const topicList = this, - topics = this.get("topics"); + topics = this.topics; // refresh dupes topics.removeObjects( @@ -115,7 +115,7 @@ const TopicList = RestModel.extend({ )}.json?topic_ids=${topic_ids.join(",")}`; const store = this.store; - return ajax({ url, data: this.get("params") }).then(result => { + return ajax({ url, data: this.params }).then(result => { let i = 0; topicList.forEachNew(TopicList.topicsFrom(store, result), function(t) { // highlight the first of the new topics so we can get a visual feedback diff --git a/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 b/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 index a5d867a6f75..0b4ef2ca93c 100644 --- a/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 +++ b/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 @@ -129,8 +129,8 @@ const TopicTrackingState = Discourse.Model.extend({ return; } - const filter = this.get("filter"); - const filterCategory = this.get("filterCategory"); + const filter = this.filter; + const filterCategory = this.filterCategory; const categoryId = data.payload && data.payload.category_id; if (filterCategory && filterCategory.get("id") !== categoryId) { diff --git a/app/assets/javascripts/discourse/models/topic.js.es6 b/app/assets/javascripts/discourse/models/topic.js.es6 index 1f54f1c3347..7f4f97c9477 100644 --- a/app/assets/javascripts/discourse/models/topic.js.es6 +++ b/app/assets/javascripts/discourse/models/topic.js.es6 @@ -60,7 +60,7 @@ const Topic = RestModel.extend({ )[0]; user = latest && latest.user; } - return user || this.get("creator"); + return user || this.creator; }, @computed("posters.[]", "participants.[]") @@ -70,7 +70,7 @@ const Topic = RestModel.extend({ const posterCount = users.length; if ( - this.get("isPrivateMessage") && + this.isPrivateMessage && participants && posterCount < maxUserCount ) { @@ -139,7 +139,7 @@ const Topic = RestModel.extend({ @computed postStream() { return this.store.createRecord("postStream", { - id: this.get("id"), + id: this.id, topic: this }); }, @@ -150,7 +150,7 @@ const Topic = RestModel.extend({ return tags; } - const title = this.get("title"); + const title = this.title; const newTags = []; tags.forEach(function(tag) { @@ -194,7 +194,7 @@ const Topic = RestModel.extend({ @computed details() { return this.store.createRecord("topicDetails", { - id: this.get("id"), + id: this.id, topic: this }); }, @@ -210,12 +210,12 @@ const Topic = RestModel.extend({ @on("init") @observes("category_id") _categoryIdChanged() { - this.set("category", Discourse.Category.findById(this.get("category_id"))); + this.set("category", Discourse.Category.findById(this.category_id)); }, @observes("categoryName") _categoryNameChanged() { - const categoryName = this.get("categoryName"); + const categoryName = this.categoryName; let category; if (categoryName) { category = this.site.get("categories").findBy("name", categoryName); @@ -250,7 +250,7 @@ const Topic = RestModel.extend({ // Helper to build a Url with a post number urlForPostNumber(postNumber) { - let url = this.get("url"); + let url = this.url; if (postNumber && postNumber > 0) { url += `/${postNumber}`; } @@ -293,7 +293,7 @@ const Topic = RestModel.extend({ @computed("url") summaryUrl() { - const summaryQueryString = this.get("has_summary") ? "?filter=summary" : ""; + const summaryQueryString = this.has_summary ? "?filter=summary" : ""; return `${this.urlForPostNumber(1)}${summaryQueryString}`; }, @@ -309,7 +309,7 @@ const Topic = RestModel.extend({ displayNewPosts(newPosts, id) { const highestSeen = Discourse.Session.currentProp("highestSeenByTopic")[id]; if (highestSeen) { - const delta = highestSeen - this.get("last_read_post_number"); + const delta = highestSeen - this.last_read_post_number; if (delta > 0) { let result = newPosts - delta; if (result < 0) { @@ -352,7 +352,7 @@ const Topic = RestModel.extend({ if (property === "closed") { this.incrementProperty("posts_count"); } - return ajax(`${this.get("url")}/status`, { + return ajax(`${this.url}/status`, { type: "PUT", data: { status: property, @@ -363,32 +363,32 @@ const Topic = RestModel.extend({ }, makeBanner() { - return ajax(`/t/${this.get("id")}/make-banner`, { type: "PUT" }).then(() => + return ajax(`/t/${this.id}/make-banner`, { type: "PUT" }).then(() => this.set("archetype", "banner") ); }, removeBanner() { - return ajax(`/t/${this.get("id")}/remove-banner`, { + return ajax(`/t/${this.id}/remove-banner`, { type: "PUT" }).then(() => this.set("archetype", "regular")); }, toggleBookmark() { - if (this.get("bookmarking")) { + if (this.bookmarking) { return Ember.RSVP.Promise.resolve(); } this.set("bookmarking", true); - const stream = this.get("postStream"); + const stream = this.postStream; const posts = Ember.get(stream, "posts"); const firstPost = posts && posts[0] && posts[0].get("post_number") === 1 && posts[0]; - const bookmark = !this.get("bookmarked"); + const bookmark = !this.bookmarked; const path = bookmark ? "/bookmark" : "/remove_bookmarks"; const toggleBookmarkOnServer = () => { - return ajax(`/t/${this.get("id")}${path}`, { type: "PUT" }) + return ajax(`/t/${this.id}${path}`, { type: "PUT" }) .then(() => { this.toggleProperty("bookmarked"); if (bookmark && firstPost) { @@ -435,14 +435,14 @@ const Topic = RestModel.extend({ }, createGroupInvite(group) { - return ajax(`/t/${this.get("id")}/invite-group`, { + return ajax(`/t/${this.id}/invite-group`, { type: "POST", data: { group } }); }, createInvite(user, group_names, custom_message) { - return ajax(`/t/${this.get("id")}/invite`, { + return ajax(`/t/${this.id}/invite`, { type: "POST", data: { user, group_names, custom_message } }); @@ -463,7 +463,7 @@ const Topic = RestModel.extend({ "details.can_delete": false, "details.can_recover": true }); - return ajax(`/t/${this.get("id")}`, { + return ajax(`/t/${this.id}`, { data: { context: window.location.pathname }, type: "DELETE" }); @@ -477,7 +477,7 @@ const Topic = RestModel.extend({ "details.can_delete": true, "details.can_recover": false }); - return ajax(`/t/${this.get("id")}/recover`, { + return ajax(`/t/${this.id}/recover`, { data: { context: window.location.pathname }, type: "PUT" }); @@ -485,7 +485,7 @@ const Topic = RestModel.extend({ // Update our attributes from a JSON result updateFromJson(json) { - this.get("details").updateFromJson(json.details); + this.details.updateFromJson(json.details); const keys = Object.keys(json); keys.removeObject("details"); @@ -495,7 +495,7 @@ const Topic = RestModel.extend({ }, reload() { - return ajax(`/t/${this.get("id")}`, { type: "GET" }).then(topic_json => + return ajax(`/t/${this.id}`, { type: "GET" }).then(topic_json => this.updateFromJson(topic_json) ); }, @@ -509,7 +509,7 @@ const Topic = RestModel.extend({ // Clear the pin optimistically from the object this.setProperties({ pinned: false, unpinned: true }); - ajax(`/t/${this.get("id")}/clear-pin`, { + ajax(`/t/${this.id}/clear-pin`, { type: "PUT" }).then(null, () => { // On error, put the pin back @@ -518,7 +518,7 @@ const Topic = RestModel.extend({ }, togglePinnedForUser() { - if (this.get("pinned")) { + if (this.pinned) { this.clearPin(); } else { this.rePin(); @@ -529,7 +529,7 @@ const Topic = RestModel.extend({ // Clear the pin optimistically from the object this.setProperties({ pinned: true, unpinned: false }); - ajax(`/t/${this.get("id")}/re-pin`, { + ajax(`/t/${this.id}/re-pin`, { type: "PUT" }).then(null, () => { // On error, put the pin back @@ -554,7 +554,7 @@ const Topic = RestModel.extend({ archiveMessage() { this.set("archiving", true); - const promise = ajax(`/t/${this.get("id")}/archive-message`, { + const promise = ajax(`/t/${this.id}/archive-message`, { type: "PUT" }); @@ -572,7 +572,7 @@ const Topic = RestModel.extend({ moveToInbox() { this.set("archiving", true); - const promise = ajax(`/t/${this.get("id")}/move-to-inbox`, { type: "PUT" }); + const promise = ajax(`/t/${this.id}/move-to-inbox`, { type: "PUT" }); promise .then(msg => { @@ -587,7 +587,7 @@ const Topic = RestModel.extend({ }, publish() { - return ajax(`/t/${this.get("id")}/publish`, { + return ajax(`/t/${this.id}/publish`, { type: "PUT", data: this.getProperties("destination_category_id") }) @@ -597,20 +597,20 @@ const Topic = RestModel.extend({ updateDestinationCategory(categoryId) { this.set("destination_category_id", categoryId); - return ajax(`/t/${this.get("id")}/shared-draft`, { + return ajax(`/t/${this.id}/shared-draft`, { method: "PUT", data: { category_id: categoryId } }); }, convertTopic(type) { - return ajax(`/t/${this.get("id")}/convert-topic/${type}`, { type: "PUT" }) + return ajax(`/t/${this.id}/convert-topic/${type}`, { type: "PUT" }) .then(() => window.location.reload()) .catch(popupAjaxError); }, resetBumpDate() { - return ajax(`/t/${this.get("id")}/reset-bump-date`, { type: "PUT" }).catch( + return ajax(`/t/${this.id}/reset-bump-date`, { type: "PUT" }).catch( popupAjaxError ); } diff --git a/app/assets/javascripts/discourse/models/user-action.js.es6 b/app/assets/javascripts/discourse/models/user-action.js.es6 index db3a357530a..e51d7c96d29 100644 --- a/app/assets/javascripts/discourse/models/user-action.js.es6 +++ b/app/assets/javascripts/discourse/models/user-action.js.es6 @@ -28,7 +28,7 @@ Object.keys(UserActionTypes).forEach( const UserAction = RestModel.extend({ @on("init") _attachCategory() { - const categoryId = this.get("category_id"); + const categoryId = this.category_id; if (categoryId) { this.set("category", Discourse.Category.findById(categoryId)); } @@ -37,34 +37,34 @@ const UserAction = RestModel.extend({ @computed("action_type") descriptionKey(action) { if (action === null || UserAction.TO_SHOW.indexOf(action) >= 0) { - if (this.get("isPM")) { - return this.get("sameUser") ? "sent_by_you" : "sent_by_user"; + if (this.isPM) { + return this.sameUser ? "sent_by_you" : "sent_by_user"; } else { - return this.get("sameUser") ? "posted_by_you" : "posted_by_user"; + return this.sameUser ? "posted_by_you" : "posted_by_user"; } } - if (this.get("topicType")) { - return this.get("sameUser") ? "you_posted_topic" : "user_posted_topic"; + if (this.topicType) { + return this.sameUser ? "you_posted_topic" : "user_posted_topic"; } - if (this.get("postReplyType")) { - if (this.get("reply_to_post_number")) { - return this.get("sameUser") + if (this.postReplyType) { + if (this.reply_to_post_number) { + return this.sameUser ? "you_replied_to_post" : "user_replied_to_post"; } else { - return this.get("sameUser") + return this.sameUser ? "you_replied_to_topic" : "user_replied_to_topic"; } } - if (this.get("mentionType")) { - if (this.get("sameUser")) { + if (this.mentionType) { + if (this.sameUser) { return "you_mentioned_user"; } else { - return this.get("targetUser") + return this.targetUser ? "user_mentioned_you" : "user_mentioned_user"; } @@ -103,18 +103,18 @@ const UserAction = RestModel.extend({ @computed() postUrl() { return postUrl( - this.get("slug"), - this.get("topic_id"), - this.get("post_number") + this.slug, + this.topic_id, + this.post_number ); }, @computed() replyUrl() { return postUrl( - this.get("slug"), - this.get("topic_id"), - this.get("reply_to_post_number") + this.slug, + this.topic_id, + this.reply_to_post_number ); }, @@ -136,7 +136,7 @@ const UserAction = RestModel.extend({ removableBookmark: Ember.computed.and("bookmarkType", "sameUser"), addChild(action) { - let groups = this.get("childGroups"); + let groups = this.childGroups; if (!groups) { groups = { likes: UserActionGroup.create({ icon: "heart" }), @@ -176,7 +176,7 @@ const UserAction = RestModel.extend({ "childGroups.bookmarks.items.[]" ) children() { - const g = this.get("childGroups"); + const g = this.childGroups; let rval = []; if (g) { rval = [g.likes, g.stars, g.edits, g.bookmarks].filter(function(i) { @@ -188,8 +188,8 @@ const UserAction = RestModel.extend({ switchToActing() { this.setProperties({ - username: this.get("acting_username"), - name: this.get("actingDisplayName") + username: this.acting_username, + name: this.actingDisplayName }); } }); diff --git a/app/assets/javascripts/discourse/models/user-badge.js.es6 b/app/assets/javascripts/discourse/models/user-badge.js.es6 index 7022a1d8fbe..a8850674a4c 100644 --- a/app/assets/javascripts/discourse/models/user-badge.js.es6 +++ b/app/assets/javascripts/discourse/models/user-badge.js.es6 @@ -5,13 +5,13 @@ import computed from "ember-addons/ember-computed-decorators"; const UserBadge = Discourse.Model.extend({ @computed postUrl: function() { - if (this.get("topic_title")) { - return "/t/-/" + this.get("topic_id") + "/" + this.get("post_number"); + if (this.topic_title) { + return "/t/-/" + this.topic_id + "/" + this.post_number; } }, // avoid the extra bindings for now revoke() { - return ajax("/user_badges/" + this.get("id"), { + return ajax("/user_badges/" + this.id, { type: "DELETE" }); } diff --git a/app/assets/javascripts/discourse/models/user-draft.js.es6 b/app/assets/javascripts/discourse/models/user-draft.js.es6 index 5004457c773..df931235fa3 100644 --- a/app/assets/javascripts/discourse/models/user-draft.js.es6 +++ b/app/assets/javascripts/discourse/models/user-draft.js.es6 @@ -25,9 +25,9 @@ export default RestModel.extend({ if (!topicId) return; return postUrl( - this.get("slug"), - this.get("topic_id"), - this.get("post_number") + this.slug, + this.topic_id, + this.post_number ); }, diff --git a/app/assets/javascripts/discourse/models/user-drafts-stream.js.es6 b/app/assets/javascripts/discourse/models/user-drafts-stream.js.es6 index 116b75f0081..c384b49569f 100644 --- a/app/assets/javascripts/discourse/models/user-drafts-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/user-drafts-stream.js.es6 @@ -44,21 +44,21 @@ export default RestModel.extend({ }, remove(draft) { - let content = this.get("content").filter( + let content = this.content.filter( item => item.draft_key !== draft.draft_key ); this.setProperties({ content, itemsLoaded: content.length }); }, findItems() { - let findUrl = this.get("baseUrl"); + let findUrl = this.baseUrl; - const lastLoadedUrl = this.get("lastLoadedUrl"); + const lastLoadedUrl = this.lastLoadedUrl; if (lastLoadedUrl === findUrl) { return Ember.RSVP.resolve(); } - if (this.get("loading")) { + if (this.loading) { return Ember.RSVP.resolve(); } @@ -90,10 +90,10 @@ export default RestModel.extend({ copy.pushObject(UserDraft.create(draft)); }); - this.get("content").pushObjects(copy); + this.content.pushObjects(copy); this.setProperties({ loaded: true, - itemsLoaded: this.get("itemsLoaded") + result.drafts.length + itemsLoaded: this.itemsLoaded + result.drafts.length }); } }) diff --git a/app/assets/javascripts/discourse/models/user-posts-stream.js.es6 b/app/assets/javascripts/discourse/models/user-posts-stream.js.es6 index 42347e7782e..a106b28fb32 100644 --- a/app/assets/javascripts/discourse/models/user-posts-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/user-posts-stream.js.es6 @@ -21,7 +21,7 @@ export default Discourse.Model.extend({ ), filterBy(opts) { - if (this.get("loaded") && this.get("filter") === opts.filter) { + if (this.loaded && this.filter === opts.filter) { return Ember.RSVP.resolve(); } @@ -41,13 +41,13 @@ export default Discourse.Model.extend({ findItems() { const self = this; - if (this.get("loading") || !this.get("canLoadMore")) { + if (this.loading || !this.canLoadMore) { return Ember.RSVP.reject(); } this.set("loading", true); - return ajax(this.get("url"), { cache: false }) + return ajax(this.url, { cache: false }) .then(function(result) { if (result) { const posts = result.map(function(post) { diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index 4af96febe85..788b58268a0 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -57,7 +57,7 @@ const User = RestModel.extend({ staff: Ember.computed.or("admin", "moderator"), destroySession() { - return ajax(`/session/${this.get("username")}`, { type: "DELETE" }); + return ajax(`/session/${this.username}`, { type: "DELETE" }); }, @computed("username_lower") @@ -95,12 +95,12 @@ const User = RestModel.extend({ @computed() path() { // no need to observe, requires a hard refresh to update - return userPath(this.get("username_lower")); + return userPath(this.username_lower); }, @computed() userApiKeys() { - const keys = this.get("user_api_keys"); + const keys = this.user_api_keys; if (keys) { return keys.map(raw => { let obj = Ember.Object.create(raw); @@ -137,8 +137,8 @@ const User = RestModel.extend({ }, pmPath(topic) { - const userId = this.get("id"); - const username = this.get("username_lower"); + const userId = this.id; + const username = this.username_lower; const details = topic && topic.get("details"); const allowedUsers = details && details.get("allowed_users"); @@ -219,7 +219,7 @@ const User = RestModel.extend({ changeUsername(new_username) { return ajax( - userPath(`${this.get("username_lower")}/preferences/username`), + userPath(`${this.username_lower}/preferences/username`), { type: "PUT", data: { new_username } @@ -228,7 +228,7 @@ const User = RestModel.extend({ }, changeEmail(email) { - return ajax(userPath(`${this.get("username_lower")}/preferences/email`), { + return ajax(userPath(`${this.username_lower}/preferences/email`), { type: "PUT", data: { email } }); @@ -332,14 +332,14 @@ const User = RestModel.extend({ // TODO: We can remove this when migrated fully to rest model. this.set("isSaving", true); - return ajax(userPath(`${this.get("username_lower")}.json`), { + return ajax(userPath(`${this.username_lower}.json`), { data: data, type: "PUT" }) .then(result => { this.set("bio_excerpt", result.user.bio_excerpt); const userProps = Ember.getProperties( - this.get("user_option"), + this.user_option, "enable_quoting", "external_links_in_new_tab", "dynamic_favicon" @@ -355,7 +355,7 @@ const User = RestModel.extend({ changePassword() { return ajax("/session/forgot_password", { dataType: "json", - data: { login: this.get("username") }, + data: { login: this.username }, type: "POST" }); }, @@ -391,7 +391,7 @@ const User = RestModel.extend({ revokeAssociatedAccount(providerName) { return ajax( - userPath(`${this.get("username")}/preferences/revoke-account`), + userPath(`${this.username}/preferences/revoke-account`), { data: { provider_name: providerName }, type: "POST" @@ -400,7 +400,7 @@ const User = RestModel.extend({ }, loadUserAction(id) { - const stream = this.get("stream"); + const stream = this.stream; return ajax(`/user_actions/${id}.json`, { cache: "false" }).then(result => { if (result && result.user_action) { const ua = result.user_action; @@ -428,7 +428,7 @@ const User = RestModel.extend({ @computed("groups.[]") filteredGroups() { - const groups = this.get("groups") || []; + const groups = this.groups || []; return groups.filter(group => { return !group.automatic || group.name === "moderators"; @@ -449,9 +449,9 @@ const User = RestModel.extend({ // The user's stat count, excluding PMs. @computed("statsExcludingPms.@each.count") statsCountNonPM() { - if (Ember.isEmpty(this.get("statsExcludingPms"))) return 0; + if (Ember.isEmpty(this.statsExcludingPms)) return 0; let count = 0; - this.get("statsExcludingPms").forEach(val => { + this.statsExcludingPms.forEach(val => { if (this.inAllStream(val)) { count += val.count; } @@ -462,8 +462,8 @@ const User = RestModel.extend({ // The user's stats, excluding PMs. @computed("stats.@each.isPM") statsExcludingPms() { - if (Ember.isEmpty(this.get("stats"))) return []; - return this.get("stats").rejectBy("isPM"); + if (Ember.isEmpty(this.stats)) return []; + return this.stats.rejectBy("isPM"); }, findDetails(options) { @@ -520,7 +520,7 @@ const User = RestModel.extend({ if (!Discourse.User.currentProp("staff")) { return Ember.RSVP.resolve(null); } - return ajax(userPath(`${this.get("username_lower")}/staff-info.json`)).then( + return ajax(userPath(`${this.username_lower}/staff-info.json`)).then( info => { this.setProperties(info); } @@ -529,22 +529,22 @@ const User = RestModel.extend({ pickAvatar(upload_id, type) { return ajax( - userPath(`${this.get("username_lower")}/preferences/avatar/pick`), + userPath(`${this.username_lower}/preferences/avatar/pick`), { type: "PUT", data: { upload_id, type } } ); }, selectAvatar(avatarUrl) { return ajax( - userPath(`${this.get("username_lower")}/preferences/avatar/select`), + userPath(`${this.username_lower}/preferences/avatar/select`), { type: "PUT", data: { url: avatarUrl } } ); }, isAllowedToUploadAFile(type) { return ( - this.get("staff") || - this.get("trust_level") > 0 || + this.staff || + this.trust_level > 0 || Discourse.SiteSettings[`newuser_max_${type}s`] > 0 ); }, @@ -605,8 +605,8 @@ const User = RestModel.extend({ }, delete: function() { - if (this.get("can_delete_account")) { - return ajax(userPath(this.get("username") + ".json"), { + if (this.can_delete_account) { + return ajax(userPath(this.username + ".json"), { type: "DELETE", data: { context: window.location.pathname } }); @@ -616,16 +616,16 @@ const User = RestModel.extend({ }, updateNotificationLevel(level, expiringAt) { - return ajax(`${userPath(this.get("username"))}/notification_level.json`, { + return ajax(`${userPath(this.username)}/notification_level.json`, { type: "PUT", data: { notification_level: level, expiring_at: expiringAt } }).then(() => { const currentUser = Discourse.User.current(); if (currentUser) { if (level === "normal" || level === "mute") { - currentUser.ignored_users.removeObject(this.get("username")); + currentUser.ignored_users.removeObject(this.username); } else if (level === "ignore") { - currentUser.ignored_users.addObject(this.get("username")); + currentUser.ignored_users.addObject(this.username); } } }); @@ -633,14 +633,14 @@ const User = RestModel.extend({ dismissBanner(bannerKey) { this.set("dismissed_banner_key", bannerKey); - ajax(userPath(this.get("username") + ".json"), { + ajax(userPath(this.username + ".json"), { type: "PUT", data: { dismissed_banner_key: bannerKey } }); }, checkEmail() { - return ajax(userPath(`${this.get("username_lower")}/emails.json`), { + return ajax(userPath(`${this.username_lower}/emails.json`), { data: { context: window.location.pathname } }).then(result => { if (result) { @@ -657,7 +657,7 @@ const User = RestModel.extend({ // let { store } = this; would fail in tests const store = Discourse.__container__.lookup("service:store"); - return ajax(userPath(`${this.get("username_lower")}/summary.json`)).then( + return ajax(userPath(`${this.username_lower}/summary.json`)).then( json => { const summary = json.user_summary; const topicMap = {}; @@ -705,20 +705,20 @@ const User = RestModel.extend({ canManageGroup(group) { return group.get("automatic") ? false - : this.get("admin") || group.get("is_group_owner"); + : this.admin || group.get("is_group_owner"); }, @computed("groups.@each.title", "badges.[]") availableTitles() { let titles = []; - (this.get("groups") || []).forEach(group => { + (this.groups || []).forEach(group => { if (group.get("title")) { titles.push(group.get("title")); } }); - (this.get("badges") || []).forEach(badge => { + (this.badges || []).forEach(badge => { if (badge.get("allow_title")) { titles.push(badge.get("name")); } diff --git a/app/assets/javascripts/discourse/raw-views/list/visited-line.js.es6 b/app/assets/javascripts/discourse/raw-views/list/visited-line.js.es6 index b276022a1d6..3626b17cb75 100644 --- a/app/assets/javascripts/discourse/raw-views/list/visited-line.js.es6 +++ b/app/assets/javascripts/discourse/raw-views/list/visited-line.js.es6 @@ -3,6 +3,6 @@ import computed from "ember-addons/ember-computed-decorators"; export default Ember.Object.extend({ @computed isLastVisited: function() { - return this.get("lastVisitedTopic") === this.get("topic"); + return this.lastVisitedTopic === this.topic; } }); diff --git a/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js.es6 b/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js.es6 index bedf8048d05..5febdd4feff 100644 --- a/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js.es6 +++ b/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js.es6 @@ -32,7 +32,7 @@ export default Ember.Object.extend({ if (this.sortable) { name.push("sortable"); - if (this.get("isSorting")) { + if (this.isSorting) { name.push("sorting"); } } diff --git a/app/assets/javascripts/discourse/raw-views/topic-status.js.es6 b/app/assets/javascripts/discourse/raw-views/topic-status.js.es6 index 6aeee4e5cda..ec334985203 100644 --- a/app/assets/javascripts/discourse/raw-views/topic-status.js.es6 +++ b/app/assets/javascripts/discourse/raw-views/topic-status.js.es6 @@ -5,12 +5,12 @@ export default Ember.Object.extend({ @computed("defaultIcon") renderDiv(defaultIcon) { - return (defaultIcon || this.get("statuses").length > 0) && !this.noDiv; + return (defaultIcon || this.statuses.length > 0) && !this.noDiv; }, @computed statuses() { - const topic = this.get("topic"); + const topic = this.topic; const results = []; // TODO, custom statuses? via override? @@ -70,7 +70,7 @@ export default Ember.Object.extend({ } }); - let defaultIcon = this.get("defaultIcon"); + let defaultIcon = this.defaultIcon; if (results.length === 0 && defaultIcon) { this.set("showDefault", defaultIcon); } diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6 index b6874ddf1e9..3ed2b9417e6 100644 --- a/app/assets/javascripts/discourse/routes/application.js.es6 +++ b/app/assets/javascripts/discourse/routes/application.js.es6 @@ -41,12 +41,12 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, { ), _collectTitleTokens(tokens) { - tokens.push(this.get("siteTitle")); + tokens.push(this.siteTitle); if ( window.location.pathname === Discourse.getURL("/") && - this.get("shortSiteDescription") !== "" + this.shortSiteDescription !== "" ) { - tokens.push(this.get("shortSiteDescription")); + tokens.push(this.shortSiteDescription); } Discourse.set("_docTitle", tokens.join(" - ")); }, diff --git a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 b/app/assets/javascripts/discourse/routes/build-category-route.js.es6 index 2726bac14e6..b2a5a00ae5f 100644 --- a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-category-route.js.es6 @@ -130,7 +130,7 @@ export default (filterArg, params) => { }, setupController(controller, model) { - const topics = this.get("topics"), + const topics = this.topics, category = model.category, canCreateTopic = topics.get("can_create_topic"), canCreateTopicOnCategory = diff --git a/app/assets/javascripts/discourse/routes/discourse.js.es6 b/app/assets/javascripts/discourse/routes/discourse.js.es6 index 6961e8e3b5f..51bdcbbc2b5 100644 --- a/app/assets/javascripts/discourse/routes/discourse.js.es6 +++ b/app/assets/javascripts/discourse/routes/discourse.js.es6 @@ -10,7 +10,7 @@ const DiscourseRoute = Ember.Route.extend({ activate() { this._super(...arguments); - if (this.get("showFooter")) { + if (this.showFooter) { this.controllerFor("application").set("showFooter", true); } }, diff --git a/app/assets/javascripts/discourse/routes/tags-show.js.es6 b/app/assets/javascripts/discourse/routes/tags-show.js.es6 index d8f03f48459..a538c4f5efa 100644 --- a/app/assets/javascripts/discourse/routes/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/routes/tags-show.js.es6 @@ -42,7 +42,7 @@ export default Discourse.Route.extend({ } f += `${params.category}/l/`; } - f += this.get("navMode"); + f += this.navMode; this.set("filterMode", f); if (params.category) { @@ -52,7 +52,7 @@ export default Discourse.Route.extend({ this.set("parentCategorySlug", params.parent_category); } - if (tag && tag.get("id") !== "none" && this.get("currentUser")) { + if (tag && tag.get("id") !== "none" && this.currentUser) { // If logged in, we should get the tag's user settings return this.store .find("tagNotification", tag.get("id").toLowerCase()) @@ -73,9 +73,9 @@ export default Discourse.Route.extend({ params.order = transition.to.queryParams.order || params.order; params.ascending = transition.to.queryParams.ascending || params.ascending; - const categorySlug = this.get("categorySlug"); - const parentCategorySlug = this.get("parentCategorySlug"); - const filter = this.get("navMode"); + const categorySlug = this.categorySlug; + const parentCategorySlug = this.parentCategorySlug; + const filter = this.navMode; const tagId = tag ? tag.id.toLowerCase() : "none"; if (categorySlug) { @@ -92,7 +92,7 @@ export default Discourse.Route.extend({ category.setupGroupsAndPermissions(); this.set("category", category); } - } else if (this.get("additionalTags")) { + } else if (this.additionalTags) { params.filter = `tags/intersection/${tagId}/${this.get( "additionalTags" ).join("/")}`; @@ -129,12 +129,12 @@ export default Discourse.Route.extend({ titleToken() { const filterText = I18n.t( - `filters.${this.get("navMode").replace("/", ".")}.title` + `filters.${this.navMode.replace("/", ".")}.title` ); const controller = this.controllerFor("tags.show"); if (controller.get("model.id")) { - if (this.get("category")) { + if (this.category) { return I18n.t("tagging.filters.with_category", { filter: filterText, tag: controller.get("model.id"), @@ -147,7 +147,7 @@ export default Discourse.Route.extend({ }); } } else { - if (this.get("category")) { + if (this.category) { return I18n.t("tagging.filters.untagged_with_category", { filter: filterText, category: this.get("category.name") @@ -164,11 +164,11 @@ export default Discourse.Route.extend({ this.controllerFor("tags.show").setProperties({ model, tag: model, - additionalTags: this.get("additionalTags"), - category: this.get("category"), - filterMode: this.get("filterMode"), - navMode: this.get("navMode"), - tagNotification: this.get("tagNotification") + additionalTags: this.additionalTags, + category: this.category, + filterMode: this.filterMode, + navMode: this.navMode, + tagNotification: this.tagNotification }); }, diff --git a/app/assets/javascripts/discourse/routes/topic.js.es6 b/app/assets/javascripts/discourse/routes/topic.js.es6 index cbedc6fae34..c25d72e1e86 100644 --- a/app/assets/javascripts/discourse/routes/topic.js.es6 +++ b/app/assets/javascripts/discourse/routes/topic.js.es6 @@ -51,9 +51,9 @@ const TopicRoute = Discourse.Route.extend({ showInvite() { let invitePanelTitle; - if (this.get("isPM")) { + if (this.isPM) { invitePanelTitle = "topic.invite_private.title"; - } else if (this.get("invitingToTopic")) { + } else if (this.invitingToTopic) { invitePanelTitle = "topic.invite_reply.title"; } else { invitePanelTitle = "user.invited.create"; diff --git a/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6 index 5da6e94dc04..5b3dc51e1d6 100644 --- a/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6 @@ -11,9 +11,9 @@ export default Discourse.Route.extend(ViewingActionType, { afterModel(model, transition) { return model.filterBy({ - filter: this.get("userActionType"), + filter: this.userActionType, noContentHelpKey: - this.get("noContentHelpKey") || "user_activity.no_default", + this.noContentHelpKey || "user_activity.no_default", actingUsername: transition.to.queryParams.acting_username }); }, @@ -24,7 +24,7 @@ export default Discourse.Route.extend(ViewingActionType, { setupController(controller, model) { controller.set("model", model); - this.viewingActionType(this.get("userActionType")); + this.viewingActionType(this.userActionType); }, actions: { diff --git a/app/assets/javascripts/discourse/routes/user-invited-show.js.es6 b/app/assets/javascripts/discourse/routes/user-invited-show.js.es6 index d7e321fcb97..54f367b7399 100644 --- a/app/assets/javascripts/discourse/routes/user-invited-show.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-invited-show.js.es6 @@ -23,7 +23,7 @@ export default Discourse.Route.extend({ filter: this.inviteFilter, searchTerm: "", totalInvites: model.invites.length, - invitesCount: this.get("invitesCount") + invitesCount: this.invitesCount }); }, diff --git a/app/assets/javascripts/discourse/routes/user-private-messages-group-archive.js.es6 b/app/assets/javascripts/discourse/routes/user-private-messages-group-archive.js.es6 index 48f231a6f01..0d37dac9235 100644 --- a/app/assets/javascripts/discourse/routes/user-private-messages-group-archive.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-private-messages-group-archive.js.es6 @@ -4,7 +4,7 @@ export default createPMRoute("groups", "private-messages-groups").extend({ groupName: null, titleToken() { - const groupName = this.get("groupName"); + const groupName = this.groupName; if (groupName) { return [ diff --git a/app/assets/javascripts/discourse/routes/user-private-messages-group.js.es6 b/app/assets/javascripts/discourse/routes/user-private-messages-group.js.es6 index d03c7749801..cea1b022f41 100644 --- a/app/assets/javascripts/discourse/routes/user-private-messages-group.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-private-messages-group.js.es6 @@ -4,7 +4,7 @@ export default createPMRoute("groups", "private-messages-groups").extend({ groupName: null, titleToken() { - const groupName = this.get("groupName"); + const groupName = this.groupName; if (groupName) return [groupName.capitalize(), I18n.t("user.private_messages")]; }, diff --git a/app/assets/javascripts/discourse/routes/user-topic-list.js.es6 b/app/assets/javascripts/discourse/routes/user-topic-list.js.es6 index c7bd8ed1477..c82e0dceea7 100644 --- a/app/assets/javascripts/discourse/routes/user-topic-list.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-topic-list.js.es6 @@ -6,7 +6,7 @@ export default Discourse.Route.extend(ViewingActionType, { }, setupController(controller, model) { - const userActionType = this.get("userActionType"); + const userActionType = this.userActionType; this.controllerFor("user").set("userActionType", userActionType); this.controllerFor("user-activity").set("userActionType", userActionType); this.controllerFor("user-topics-list").setProperties({ diff --git a/app/assets/javascripts/discourse/services/logs-notice.js.es6 b/app/assets/javascripts/discourse/services/logs-notice.js.es6 index 02fb3ba2399..3dc12315bcd 100644 --- a/app/assets/javascripts/discourse/services/logs-notice.js.es6 +++ b/app/assets/javascripts/discourse/services/logs-notice.js.es6 @@ -12,7 +12,7 @@ const LogsNotice = Ember.Object.extend({ @on("init") _setup() { - if (!this.get("isActivated")) return; + if (!this.isActivated) return; const text = this.keyValueStore.getItem(LOGS_NOTICE_KEY); if (text) this.set("text", text); @@ -72,7 +72,7 @@ const LogsNotice = Ember.Object.extend({ @observes("text") _updateKeyValueStore() { - this.keyValueStore.setItem(LOGS_NOTICE_KEY, this.get("text")); + this.keyValueStore.setItem(LOGS_NOTICE_KEY, this.text); }, @computed( diff --git a/app/assets/javascripts/discourse/services/search.js.es6 b/app/assets/javascripts/discourse/services/search.js.es6 index 7b56e8156b8..2a47789da4d 100644 --- a/app/assets/javascripts/discourse/services/search.js.es6 +++ b/app/assets/javascripts/discourse/services/search.js.es6 @@ -11,7 +11,7 @@ export default Ember.Object.extend({ @observes("term") _sethighlightTerm() { - this.set("highlightTerm", this.get("term")); + this.set("highlightTerm", this.term); }, @computed("searchContext") diff --git a/app/assets/javascripts/select-kit/components/admin-group-selector.js.es6 b/app/assets/javascripts/select-kit/components/admin-group-selector.js.es6 index 0c79d92a4d5..ddc883ee077 100644 --- a/app/assets/javascripts/select-kit/components/admin-group-selector.js.es6 +++ b/app/assets/javascripts/select-kit/components/admin-group-selector.js.es6 @@ -13,12 +13,12 @@ export default MultiSelectComponent.extend({ @computed("buffer") values(buffer) { return buffer === null - ? makeArray(this.get("selected")).map(s => this.valueForContentItem(s)) + ? makeArray(this.selected).map(s => this.valueForContentItem(s)) : buffer; }, computeContent() { - return makeArray(this.get("available")); + return makeArray(this.available); }, computeContentItem(contentItem, name) { diff --git a/app/assets/javascripts/select-kit/components/category-chooser.js.es6 b/app/assets/javascripts/select-kit/components/category-chooser.js.es6 index 6a3b541fd96..3df3e049c9f 100644 --- a/app/assets/javascripts/select-kit/components/category-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-chooser.js.es6 @@ -19,8 +19,8 @@ export default ComboBoxComponent.extend({ init() { this._super(...arguments); - this.get("rowComponentOptions").setProperties({ - allowUncategorized: this.get("allowUncategorized") + this.rowComponentOptions.setProperties({ + allowUncategorized: this.allowUncategorized }); }, @@ -29,7 +29,7 @@ export default ComboBoxComponent.extend({ return computedContent; } - if (this.get("scopedCategoryId")) { + if (this.scopedCategoryId) { computedContent = this.categoriesByScope().map(c => this.computeContentItem(c) ); @@ -57,7 +57,7 @@ export default ComboBoxComponent.extend({ none(rootNone, rootNoneLabel) { if ( this.siteSettings.allow_uncategorized_topics || - this.get("allowUncategorized") + this.allowUncategorized ) { if (!isNone(rootNone)) { return rootNoneLabel || "category.none"; @@ -72,7 +72,7 @@ export default ComboBoxComponent.extend({ computeHeaderContent() { let content = this._super(...arguments); - if (this.get("hasSelection")) { + if (this.hasSelection) { const category = Category.findById(content.value); const parentCategoryId = category.get("parent_category_id"); const hasParentCategory = Ember.isPresent(parentCategoryId); @@ -112,7 +112,7 @@ export default ComboBoxComponent.extend({ }, computeContent() { - return this.categoriesByScope(this.get("scopedCategoryId")); + return this.categoriesByScope(this.scopedCategoryId); }, categoriesByScope(scopedCategoryId = null) { @@ -126,7 +126,7 @@ export default ComboBoxComponent.extend({ scopedCat.get("parent_category_id") || scopedCat.get("id"); } - const excludeCategoryId = this.get("excludeCategoryId"); + const excludeCategoryId = this.excludeCategoryId; return categories.filter(c => { const categoryId = this.valueForContentItem(c); @@ -139,20 +139,20 @@ export default ComboBoxComponent.extend({ return false; } - if (this.get("allowSubCategories") === false && c.get("parentCategory")) { + if (this.allowSubCategories === false && c.get("parentCategory")) { return false; } if ( - (this.get("allowUncategorized") === false && + (this.allowUncategorized === false && get(c, "isUncategorizedCategory")) || excludeCategoryId === categoryId ) { return false; } - if (this.get("permissionType")) { - return this.get("permissionType") === get(c, "permission"); + if (this.permissionType) { + return this.permissionType === get(c, "permission"); } return true; diff --git a/app/assets/javascripts/select-kit/components/category-drop.js.es6 b/app/assets/javascripts/select-kit/components/category-drop.js.es6 index e62b894225e..425c2bb038b 100644 --- a/app/assets/javascripts/select-kit/components/category-drop.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-drop.js.es6 @@ -34,7 +34,7 @@ export default ComboBoxComponent.extend({ if (hasSelection || (noSubcategories && subCategory)) { shortcuts.push({ - name: this.get("allCategoriesLabel"), + name: this.allCategoriesLabel, __sk_row_type: "noopRow", id: "all-categories" }); @@ -42,7 +42,7 @@ export default ComboBoxComponent.extend({ if (subCategory && (hasSelection || !noSubcategories)) { shortcuts.push({ - name: this.get("noCategoriesLabel"), + name: this.noCategoriesLabel, __sk_row_type: "noopRow", id: "no-categories" }); @@ -54,10 +54,10 @@ export default ComboBoxComponent.extend({ init() { this._super(...arguments); - this.get("rowComponentOptions").setProperties({ - hideParentCategory: this.get("subCategory"), + this.rowComponentOptions.setProperties({ + hideParentCategory: this.subCategory, allowUncategorized: true, - countSubcategories: this.get("countSubcategories"), + countSubcategories: this.countSubcategories, displayCategoryDescription: !( this.currentUser && (this.currentUser.get("staff") || this.currentUser.trust_level > 0) @@ -66,7 +66,7 @@ export default ComboBoxComponent.extend({ }, didReceiveAttrs() { - if (!this.get("categories")) this.set("categories", []); + if (!this.categories) this.set("categories", []); this.forceValue(this.get("category.id")); }, @@ -75,14 +75,14 @@ export default ComboBoxComponent.extend({ const contentLength = (content && content.length) || 0; return ( contentLength >= 15 || - (this.get("isAsync") && contentLength < Discourse.Category.list().length) + (this.isAsync && contentLength < Discourse.Category.list().length) ); }, computeHeaderContent() { let content = this._super(...arguments); - if (this.get("hasSelection")) { + if (this.hasSelection) { const category = Category.findById(content.value); content.title = category.title; content.label = categoryBadgeHTML(category, { @@ -91,16 +91,16 @@ export default ComboBoxComponent.extend({ hideParent: true }).htmlSafe(); } else { - if (this.get("noSubcategories")) { + if (this.noSubcategories) { content.label = `${this.get( "noCategoriesLabel" )}`; - content.title = this.get("noCategoriesLabel"); + content.title = this.noCategoriesLabel; } else { content.label = `${this.get( "allCategoriesLabel" )}`; - content.title = this.get("allCategoriesLabel"); + content.title = this.allCategoriesLabel; } } @@ -130,9 +130,9 @@ export default ComboBoxComponent.extend({ let categoryURL; if (categoryId === "all-categories") { - categoryURL = Discourse.getURL(this.get("allCategoriesUrl")); + categoryURL = Discourse.getURL(this.allCategoriesUrl); } else if (categoryId === "no-categories") { - categoryURL = Discourse.getURL(this.get("noCategoriesUrl")); + categoryURL = Discourse.getURL(this.noCategoriesUrl); } else { const category = Category.findById(parseInt(categoryId, 10)); const slug = Discourse.Category.slugFor(category); @@ -143,18 +143,18 @@ export default ComboBoxComponent.extend({ }, onExpand() { - if (this.get("isAsync") && isEmpty(this.get("asyncContent"))) { - this.set("asyncContent", this.get("content")); + if (this.isAsync && isEmpty(this.asyncContent)) { + this.set("asyncContent", this.content); } }, onFilter(filter) { - if (!this.get("isAsync")) { + if (!this.isAsync) { return; } if (isEmpty(filter)) { - this.set("asyncContent", this.get("content")); + this.set("asyncContent", this.content); return; } diff --git a/app/assets/javascripts/select-kit/components/category-drop/category-drop-header.js.es6 b/app/assets/javascripts/select-kit/components/category-drop/category-drop-header.js.es6 index 7c837090633..37ad706fadb 100644 --- a/app/assets/javascripts/select-kit/components/category-drop/category-drop-header.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-drop/category-drop-header.js.es6 @@ -57,7 +57,7 @@ export default ComboBoxSelectBoxHeaderComponent.extend({ didRender() { this._super(...arguments); - this.$().attr("style", this.get("categoryStyle")); - this.$(".caret-icon").attr("style", this.get("categoryStyle")); + this.$().attr("style", this.categoryStyle); + this.$(".caret-icon").attr("style", this.categoryStyle); } }); diff --git a/app/assets/javascripts/select-kit/components/category-notifications-button.js.es6 b/app/assets/javascripts/select-kit/components/category-notifications-button.js.es6 index 941e21f96d5..17c8e4de416 100644 --- a/app/assets/javascripts/select-kit/components/category-notifications-button.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-notifications-button.js.es6 @@ -10,7 +10,7 @@ export default NotificationOptionsComponent.extend({ allowInitialValueMutation: false, mutateValue(value) { - this.get("category").setNotification(value); + this.category.setNotification(value); }, deselect() {} diff --git a/app/assets/javascripts/select-kit/components/category-row.js.es6 b/app/assets/javascripts/select-kit/components/category-row.js.es6 index 6b7a5ba1063..c0c3657b1c6 100644 --- a/app/assets/javascripts/select-kit/components/category-row.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-row.js.es6 @@ -40,8 +40,8 @@ export default SelectKitRowComponent.extend({ @computed("category", "parentCategory") badgeForCategory(category, parentCategory) { return categoryBadgeHTML(category, { - link: this.get("categoryLink"), - allowUncategorized: this.get("allowUncategorized"), + link: this.categoryLink, + allowUncategorized: this.allowUncategorized, hideParent: parentCategory ? true : false }).htmlSafe(); }, @@ -49,8 +49,8 @@ export default SelectKitRowComponent.extend({ @computed("parentCategory") badgeForParentCategory(parentCategory) { return categoryBadgeHTML(parentCategory, { - link: this.get("categoryLink"), - allowUncategorized: this.get("allowUncategorized") + link: this.categoryLink, + allowUncategorized: this.allowUncategorized }).htmlSafe(); }, diff --git a/app/assets/javascripts/select-kit/components/category-selector.js.es6 b/app/assets/javascripts/select-kit/components/category-selector.js.es6 index 53aed68b1e5..81d11929c18 100644 --- a/app/assets/javascripts/select-kit/components/category-selector.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-selector.js.es6 @@ -14,21 +14,21 @@ export default MultiSelectComponent.extend({ init() { this._super(...arguments); - if (!this.get("categories")) this.set("categories", []); - if (!this.get("blacklist")) this.set("blacklist", []); + if (!this.categories) this.set("categories", []); + if (!this.blacklist) this.set("blacklist", []); - this.get("headerComponentOptions").setProperties({ + this.headerComponentOptions.setProperties({ selectedNameComponent: "multi-select/selected-category" }); - this.get("rowComponentOptions").setProperties({ - allowUncategorized: this.get("allowUncategorized"), + this.rowComponentOptions.setProperties({ + allowUncategorized: this.allowUncategorized, displayCategoryDescription: false }); }, computeValues() { - return Ember.makeArray(this.get("categories")).map(c => c.id); + return Ember.makeArray(this.categories).map(c => c.id); }, mutateValues(values) { @@ -43,10 +43,10 @@ export default MultiSelectComponent.extend({ }, computeContent() { - const blacklist = Ember.makeArray(this.get("blacklist")); + const blacklist = Ember.makeArray(this.blacklist); return Category.list().filter(category => { return ( - this.get("categories").includes(category) || + this.categories.includes(category) || !blacklist.includes(category) ); }); diff --git a/app/assets/javascripts/select-kit/components/combo-box.js.es6 b/app/assets/javascripts/select-kit/components/combo-box.js.es6 index 65cf8b842a3..09e8a7c7bdf 100644 --- a/app/assets/javascripts/select-kit/components/combo-box.js.es6 +++ b/app/assets/javascripts/select-kit/components/combo-box.js.es6 @@ -16,7 +16,7 @@ export default SingleSelectComponent.extend({ computeHeaderContent() { let content = this._super(...arguments); - content.hasSelection = this.get("hasSelection"); + content.hasSelection = this.hasSelection; return content; }, @@ -27,8 +27,8 @@ export default SingleSelectComponent.extend({ @on("didUpdateAttrs", "init") _setComboBoxOptions() { - this.get("headerComponentOptions").setProperties({ - clearable: this.get("clearable") + this.headerComponentOptions.setProperties({ + clearable: this.clearable }); } }); diff --git a/app/assets/javascripts/select-kit/components/composer-actions.js.es6 b/app/assets/javascripts/select-kit/components/composer-actions.js.es6 index 1d62264f5c4..2f95497511f 100644 --- a/app/assets/javascripts/select-kit/components/composer-actions.js.es6 +++ b/app/assets/javascripts/select-kit/components/composer-actions.js.es6 @@ -55,7 +55,7 @@ export default DropdownSelectBoxComponent.extend({ computeHeaderContent() { let content = this._super(...arguments); - switch (this.get("action")) { + switch (this.action) { case PRIVATE_MESSAGE: case CREATE_TOPIC: case REPLY: @@ -296,7 +296,7 @@ export default DropdownSelectBoxComponent.extend({ onSelect(value) { let action = `${Ember.String.camelize(value)}Selected`; if (this[action]) { - let model = this.get("composerModel"); + let model = this.composerModel; this[action]( model.getProperties( "draftKey", diff --git a/app/assets/javascripts/select-kit/components/dropdown-select-box.js.es6 b/app/assets/javascripts/select-kit/components/dropdown-select-box.js.es6 index 773710c0e16..1bbf6d510ee 100644 --- a/app/assets/javascripts/select-kit/components/dropdown-select-box.js.es6 +++ b/app/assets/javascripts/select-kit/components/dropdown-select-box.js.es6 @@ -15,13 +15,13 @@ export default SingleSelectComponent.extend({ @on("didUpdateAttrs", "init") _setDropdownSelectBoxComponentOptions() { - this.get("headerComponentOptions").setProperties({ - showFullTitle: this.get("showFullTitle") + this.headerComponentOptions.setProperties({ + showFullTitle: this.showFullTitle }); }, didClickOutside() { - if (!this.get("isExpanded")) return; + if (!this.isExpanded) return; this.close(); }, diff --git a/app/assets/javascripts/select-kit/components/future-date-input-selector.js.es6 b/app/assets/javascripts/select-kit/components/future-date-input-selector.js.es6 index a9c325abe0f..7944b825980 100644 --- a/app/assets/javascripts/select-kit/components/future-date-input-selector.js.es6 +++ b/app/assets/javascripts/select-kit/components/future-date-input-selector.js.es6 @@ -195,10 +195,10 @@ export default ComboBoxComponent.extend(DatetimeMixin, { computeHeaderContent() { let content = this._super(...arguments); - content.datetime = this._computeDatetimeForValue(this.get("computedValue")); + content.datetime = this._computeDatetimeForValue(this.computedValue); content.name = this.get("selection.name") || content.name; - content.hasSelection = this.get("hasSelection"); - content.icons = this._computeIconsForValue(this.get("computedValue")); + content.hasSelection = this.hasSelection; + content.icons = this._computeIconsForValue(this.computedValue); return content; }, @@ -216,11 +216,11 @@ export default ComboBoxComponent.extend(DatetimeMixin, { let opts = { now, day: now.day(), - includeWeekend: this.get("includeWeekend"), - includeMidFuture: this.get("includeMidFuture") || true, - includeFarFuture: this.get("includeFarFuture"), - includeDateTime: this.get("includeDateTime"), - includeBasedOnLastPost: this.get("statusType") === CLOSE_STATUS_TYPE, + includeWeekend: this.includeWeekend, + includeMidFuture: this.includeMidFuture || true, + includeFarFuture: this.includeFarFuture, + includeDateTime: this.includeDateTime, + includeBasedOnLastPost: this.statusType === CLOSE_STATUS_TYPE, canScheduleToday: 24 - now.hour() > 6 }; @@ -233,7 +233,7 @@ export default ComboBoxComponent.extend(DatetimeMixin, { }, mutateValue(value) { - if (value === "pick_date_and_time" || this.get("isBasedOnLastPost")) { + if (value === "pick_date_and_time" || this.isBasedOnLastPost) { this.set("value", value); } else { let input = null; diff --git a/app/assets/javascripts/select-kit/components/future-date-input-selector/mixin.js.es6 b/app/assets/javascripts/select-kit/components/future-date-input-selector/mixin.js.es6 index a25dacdd083..d40b2398e7d 100644 --- a/app/assets/javascripts/select-kit/components/future-date-input-selector/mixin.js.es6 +++ b/app/assets/javascripts/select-kit/components/future-date-input-selector/mixin.js.es6 @@ -37,7 +37,7 @@ export default Ember.Mixin.create({ return { time: details.when( moment(), - this.get("statusType") !== CLOSE_STATUS_TYPE ? 8 : 18 + this.statusType !== CLOSE_STATUS_TYPE ? 8 : 18 ), icon: details.icon }; diff --git a/app/assets/javascripts/select-kit/components/group-dropdown.js.es6 b/app/assets/javascripts/select-kit/components/group-dropdown.js.es6 index 53406d7c687..882bf46cb98 100644 --- a/app/assets/javascripts/select-kit/components/group-dropdown.js.es6 +++ b/app/assets/javascripts/select-kit/components/group-dropdown.js.es6 @@ -20,7 +20,7 @@ export default ComboBoxComponent.extend({ computeHeaderContent() { let content = this._super(...arguments); - if (!this.get("hasSelection")) { + if (!this.hasSelection) { content.label = `${I18n.t("groups.index.all")}`; } diff --git a/app/assets/javascripts/select-kit/components/group-notifications-button.js.es6 b/app/assets/javascripts/select-kit/components/group-notifications-button.js.es6 index 8236e4bbe14..7c94a73bae8 100644 --- a/app/assets/javascripts/select-kit/components/group-notifications-button.js.es6 +++ b/app/assets/javascripts/select-kit/components/group-notifications-button.js.es6 @@ -7,6 +7,6 @@ export default NotificationOptionsComponent.extend({ allowInitialValueMutation: false, mutateValue(value) { - this.get("group").setNotification(value, this.get("user.id")); + this.group.setNotification(value, this.get("user.id")); } }); diff --git a/app/assets/javascripts/select-kit/components/list-setting.js.es6 b/app/assets/javascripts/select-kit/components/list-setting.js.es6 index d9eb18f53fd..e150b55c49a 100644 --- a/app/assets/javascripts/select-kit/components/list-setting.js.es6 +++ b/app/assets/javascripts/select-kit/components/list-setting.js.es6 @@ -12,12 +12,12 @@ export default MultiSelectComponent.extend({ init() { this._super(...arguments); - if (!isNone(this.get("settingName"))) { - this.set("nameProperty", this.get("settingName")); + if (!isNone(this.settingName)) { + this.set("nameProperty", this.settingName); } - if (this.get("nameProperty").indexOf("color") > -1) { - this.get("headerComponentOptions").setProperties({ + if (this.nameProperty.indexOf("color") > -1) { + this.headerComponentOptions.setProperties({ selectedNameComponent: "multi-select/selected-color" }); } @@ -25,22 +25,22 @@ export default MultiSelectComponent.extend({ computeContent() { let content; - if (isNone(this.get("choices"))) { - content = this.get("settingValue").split(this.get("tokenSeparator")); + if (isNone(this.choices)) { + content = this.settingValue.split(this.tokenSeparator); } else { - content = this.get("choices"); + content = this.choices; } return makeArray(content).filter(c => c); }, mutateValues(values) { - this.set("settingValue", values.join(this.get("tokenSeparator"))); + this.set("settingValue", values.join(this.tokenSeparator)); }, computeValues() { - return this.get("settingValue") - .split(this.get("tokenSeparator")) + return this.settingValue + .split(this.tokenSeparator) .filter(c => c); }, diff --git a/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 index 3be3b65fd1a..a5639af9144 100644 --- a/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 @@ -29,7 +29,7 @@ export default ComboBox.extend(TagsMixin, { this.set("termMatchesForbidden", false); this.selectionSelector = ".selected-tag"; - if (this.get("allowCreate") !== false) { + if (this.allowCreate !== false) { this.set("allowCreate", this.site.get("can_create_tag")); } @@ -44,8 +44,8 @@ export default ComboBox.extend(TagsMixin, { this.set( "maximum", parseInt( - this.get("limit") || - this.get("maximum") || + this.limit || + this.maximum || this.get("siteSettings.max_tags_per_topic") ) ); @@ -89,21 +89,21 @@ export default ComboBox.extend(TagsMixin, { mutateValue() {}, didPressTab(event) { - if (this.get("isLoading")) { + if (this.isLoading) { this._destroyEvent(event); return false; } - if (isEmpty(this.get("filter")) && !this.get("highlighted")) { + if (isEmpty(this.filter) && !this.highlighted) { this.$header().focus(); this.close(event); return true; } - if (this.get("highlighted") && this.get("isExpanded")) { + if (this.highlighted && this.isExpanded) { this._destroyEvent(event); this.focus(); - this.select(this.get("highlighted")); + this.select(this.highlighted); return false; } else { this.close(event); @@ -143,20 +143,20 @@ export default ComboBox.extend(TagsMixin, { computeHeaderContent() { let content = this._super(...arguments); - const joinedTags = this.get("selection") + const joinedTags = this.selection .map(s => Ember.get(s, "value")) .join(", "); - if (isEmpty(this.get("selection"))) { + if (isEmpty(this.selection)) { content.label = I18n.t("tagging.choose_for_topic"); } else { content.label = joinedTags; } - if (!this.get("hasReachedMinimum") && isEmpty(this.get("selection"))) { + if (!this.hasReachedMinimum && isEmpty(this.selection)) { const key = - this.get("minimumLabel") || "select_kit.min_content_not_reached"; - const label = I18n.t(key, { count: this.get("minimum") }); + this.minimumLabel || "select_kit.min_content_not_reached"; + const label = I18n.t(key, { count: this.minimum }); content.title = content.name = content.label = label; } @@ -169,16 +169,16 @@ export default ComboBox.extend(TagsMixin, { const data = { q: query, limit: this.get("siteSettings.max_tag_search_results"), - categoryId: this.get("categoryId") + categoryId: this.categoryId }; - if (this.get("selection")) { - data.selected_tags = this.get("selection") + if (this.selection) { + data.selected_tags = this.selection .map(s => Ember.get(s, "value")) .slice(0, 100); } - if (!this.get("everyTag")) data.filterForInput = true; + if (!this.everyTag) data.filterForInput = true; this.searchTags("/tags/filter/search", data, this._transformJson); }, @@ -208,13 +208,13 @@ export default ComboBox.extend(TagsMixin, { // work around usage with buffered proxy // it does not listen on array changes, similar hack already on select // TODO: FIX buffered-proxy.js to support arrays - this.get("tags").removeObjects(tags); - this.set("tags", this.get("tags").slice(0)); + this.tags.removeObjects(tags); + this.set("tags", this.tags.slice(0)); this._tagsChanged(); this.set( "searchDebounce", - run.debounce(this, this._prepareSearch, this.get("filter"), 350) + run.debounce(this, this._prepareSearch, this.filter, 350) ); }, @@ -224,24 +224,24 @@ export default ComboBox.extend(TagsMixin, { _tagsChanged() { if (this.attrs.onChangeTags) { - this.attrs.onChangeTags({ target: { value: this.get("tags") } }); + this.attrs.onChangeTags({ target: { value: this.tags } }); } }, actions: { onSelect(tag) { - this.set("tags", makeArray(this.get("tags")).concat(tag)); + this.set("tags", makeArray(this.tags).concat(tag)); this._tagsChanged(); - this._prepareSearch(this.get("filter")); + this._prepareSearch(this.filter); this.autoHighlight(); }, onExpand() { - if (isEmpty(this.get("collectionComputedContent"))) { + if (isEmpty(this.collectionComputedContent)) { this.set( "searchDebounce", - run.debounce(this, this._prepareSearch, this.get("filter"), 350) + run.debounce(this, this._prepareSearch, this.filter, 350) ); } }, diff --git a/app/assets/javascripts/select-kit/components/multi-select.js.es6 b/app/assets/javascripts/select-kit/components/multi-select.js.es6 index d380c349d44..8b72423ffb2 100644 --- a/app/assets/javascripts/select-kit/components/multi-select.js.es6 +++ b/app/assets/javascripts/select-kit/components/multi-select.js.es6 @@ -27,12 +27,12 @@ export default SelectKitComponent.extend({ this.set("computedValues", []); - if (isNone(this.get("values"))) { + if (isNone(this.values)) { this.set("values", []); } - this.get("headerComponentOptions").setProperties({ - selectedNameComponent: this.get("selectedNameComponent") + this.headerComponentOptions.setProperties({ + selectedNameComponent: this.selectedNameComponent }); }, @@ -48,11 +48,11 @@ export default SelectKitComponent.extend({ _compute() { run.scheduleOnce("afterRender", () => { this.willComputeAttributes(); - let content = this.get("content") || []; - let asyncContent = this.get("asyncContent") || []; + let content = this.content || []; + let asyncContent = this.asyncContent || []; content = this.willComputeContent(content); asyncContent = this.willComputeAsyncContent(asyncContent); - let values = this._beforeWillComputeValues(this.get("values")); + let values = this._beforeWillComputeValues(this.values); content = this.computeContent(content); asyncContent = this.computeAsyncContent(asyncContent); content = this._beforeDidComputeContent(content); @@ -104,10 +104,10 @@ export default SelectKitComponent.extend({ mutateAttributes() { run.next(() => { - if (this.get("isDestroyed") || this.get("isDestroying")) return; + if (this.isDestroyed || this.isDestroying) return; - this.mutateContent(this.get("computedContent")); - this.mutateValues(this.get("computedValues")); + this.mutateContent(this.computedContent); + this.mutateValues(this.computedValues); }); }, mutateValues(computedValues) { @@ -132,8 +132,8 @@ export default SelectKitComponent.extend({ return !computedValues.includes(get(c, "value")); }); - if (this.get("limitMatches")) { - return computedAsyncContent.slice(0, this.get("limitMatches")); + if (this.limitMatches) { + return computedAsyncContent.slice(0, this.limitMatches); } return computedAsyncContent; @@ -145,7 +145,7 @@ export default SelectKitComponent.extend({ return !computedValues.includes(get(c, "value")); }); - if (this.get("shouldFilter")) { + if (this.shouldFilter) { computedContent = this.filterComputedContent( computedContent, computedValues, @@ -153,8 +153,8 @@ export default SelectKitComponent.extend({ ); } - if (this.get("limitMatches")) { - return computedContent.slice(0, this.get("limitMatches")); + if (this.limitMatches) { + return computedContent.slice(0, this.limitMatches); } return computedContent; @@ -162,22 +162,22 @@ export default SelectKitComponent.extend({ computeHeaderContent() { let content = { - title: this.get("title"), - selection: this.get("selection") + title: this.title, + selection: this.selection }; - if (this.get("noneLabel")) { - if (!this.get("hasSelection")) { + if (this.noneLabel) { + if (!this.hasSelection) { content.title = content.name = content.label = I18n.t( - this.get("noneLabel") + this.noneLabel ); } } else { - if (!this.get("hasReachedMinimum")) { + if (!this.hasReachedMinimum) { const key = - this.get("minimumLabel") || "select_kit.min_content_not_reached"; + this.minimumLabel || "select_kit.min_content_not_reached"; content.title = content.name = content.label = I18n.t(key, { - count: this.get("minimum") + count: this.minimum }); } } @@ -195,7 +195,7 @@ export default SelectKitComponent.extend({ }, validateSelect() { - return this._super() && !this.get("hasReachedMaximum"); + return this._super() && !this.hasReachedMaximum; }, @computed("computedValues.[]", "computedContent.[]") @@ -216,16 +216,16 @@ export default SelectKitComponent.extend({ }, didPressTab(event) { - if (isEmpty(this.get("filter")) && !this.get("highlighted")) { + if (isEmpty(this.filter) && !this.highlighted) { this.$header().focus(); this.close(event); return true; } - if (this.get("highlighted") && this.get("isExpanded")) { + if (this.highlighted && this.isExpanded) { this._destroyEvent(event); this.focus(); - this.select(this.get("highlighted")); + this.select(this.highlighted); return false; } else { this.close(event); @@ -236,18 +236,18 @@ export default SelectKitComponent.extend({ autoHighlight() { run.schedule("afterRender", () => { - if (!this.get("isExpanded")) return; - if (!this.get("renderedBodyOnce")) return; - if (this.get("highlighted")) return; + if (!this.isExpanded) return; + if (!this.renderedBodyOnce) return; + if (this.highlighted) return; - if (isEmpty(this.get("collectionComputedContent"))) { - if (this.get("createRowComputedContent")) { - this.highlight(this.get("createRowComputedContent")); + if (isEmpty(this.collectionComputedContent)) { + if (this.createRowComputedContent) { + this.highlight(this.createRowComputedContent); } else if ( - this.get("noneRowComputedContent") && - this.get("hasSelection") + this.noneRowComputedContent && + this.hasSelection ) { - this.highlight(this.get("noneRowComputedContent")); + this.highlight(this.noneRowComputedContent); } } else { this.highlight(this.get("collectionComputedContent.firstObject")); @@ -261,7 +261,7 @@ export default SelectKitComponent.extend({ computedContentItem.__sk_row_type === "noneRow" ) { applyOnSelectNonePluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, this ); this._boundaryActionHandler("onSelectNone"); @@ -271,7 +271,7 @@ export default SelectKitComponent.extend({ if (computedContentItem.__sk_row_type === "noopRow") { applyOnSelectPluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, computedContentItem.value, this ); @@ -282,13 +282,13 @@ export default SelectKitComponent.extend({ if (computedContentItem.__sk_row_type === "createRow") { if ( - !this.get("computedValues").includes(computedContentItem.value) && + !this.computedValues.includes(computedContentItem.value) && this.validateCreate(computedContentItem.value) ) { this.willCreate(computedContentItem); computedContentItem.__sk_row_type = null; - this.get("computedContent").pushObject(computedContentItem); + this.computedContent.pushObject(computedContentItem); run.schedule("afterRender", () => { this.didCreate(computedContentItem); @@ -307,7 +307,7 @@ export default SelectKitComponent.extend({ this.willSelect(computedContentItem); this.clearFilter(); this.setProperties({ highlighted: null }); - this.get("computedValues").pushObject(computedContentItem.value); + this.computedValues.pushObject(computedContentItem.value); run.next(() => this.mutateAttributes()); @@ -315,7 +315,7 @@ export default SelectKitComponent.extend({ this.didSelect(computedContentItem); applyOnSelectPluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, computedContentItem.value, this ); @@ -337,10 +337,10 @@ export default SelectKitComponent.extend({ makeArray(rowComputedContentItems) ); this.setProperties({ highlighted: null, highlightedSelection: [] }); - this.get("computedValues").removeObjects( + this.computedValues.removeObjects( rowComputedContentItems.map(r => r.value) ); - this.get("computedContent").removeObjects([ + this.computedContent.removeObjects([ ...rowComputedContentItems, ...generatedComputedContents ]); diff --git a/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 b/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 index 9b82221f005..d821b701938 100644 --- a/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 +++ b/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 @@ -22,7 +22,7 @@ export default SelectKitHeaderComponent.extend({ @on("didRender") _positionFilter() { - if (!this.get("shouldDisplayFilter")) return; + if (!this.shouldDisplayFilter) return; const $filter = this.$(".filter"); $filter.width(0); diff --git a/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6 b/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6 index 78479c14484..1b81ae1eb27 100644 --- a/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6 +++ b/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6 @@ -42,12 +42,12 @@ export default Ember.Component.extend({ @computed("computedContent", "highlightedSelection.[]") isHighlighted(computedContent, highlightedSelection) { - return highlightedSelection.includes(this.get("computedContent")); + return highlightedSelection.includes(this.computedContent); }, click() { - if (this.get("isLocked")) return false; - this.onClickSelectionItem([this.get("computedContent")]); + if (this.isLocked) return false; + this.onClickSelectionItem([this.computedContent]); return false; } }); diff --git a/app/assets/javascripts/select-kit/components/none-category-row.js.es6 b/app/assets/javascripts/select-kit/components/none-category-row.js.es6 index 7e92c2bc85c..8488a93a4a5 100644 --- a/app/assets/javascripts/select-kit/components/none-category-row.js.es6 +++ b/app/assets/javascripts/select-kit/components/none-category-row.js.es6 @@ -9,7 +9,7 @@ export default CategoryRowComponent.extend({ @computed("category") badgeForCategory(category) { return categoryBadgeHTML(category, { - link: this.get("categoryLink"), + link: this.categoryLink, allowUncategorized: true, hideParent: true }).htmlSafe(); diff --git a/app/assets/javascripts/select-kit/components/notifications-button.js.es6 b/app/assets/javascripts/select-kit/components/notifications-button.js.es6 index 8629739ad50..fcfe0c5c8c0 100644 --- a/app/assets/javascripts/select-kit/components/notifications-button.js.es6 +++ b/app/assets/javascripts/select-kit/components/notifications-button.js.es6 @@ -28,9 +28,9 @@ export default DropdownSelectBoxComponent.extend({ @on("init") @observes("i18nPostfix") _setNotificationsButtonComponentOptions() { - this.get("rowComponentOptions").setProperties({ - i18nPrefix: this.get("i18nPrefix"), - i18nPostfix: this.get("i18nPostfix") + this.rowComponentOptions.setProperties({ + i18nPrefix: this.i18nPrefix, + i18nPostfix: this.i18nPostfix }); }, @@ -39,11 +39,11 @@ export default DropdownSelectBoxComponent.extend({ computeHeaderContent() { let content = this._super(...arguments); content.name = I18n.t( - `${this.get("i18nPrefix")}.${this.get("selectedDetails.key")}${this.get( + `${this.i18nPrefix}.${this.get("selectedDetails.key")}${this.get( "i18nPostfix" )}.title` ); - content.hasSelection = this.get("hasSelection"); + content.hasSelection = this.hasSelection; return content; }, diff --git a/app/assets/javascripts/select-kit/components/period-chooser.js.es6 b/app/assets/javascripts/select-kit/components/period-chooser.js.es6 index 74dd2d84455..56a20799882 100644 --- a/app/assets/javascripts/select-kit/components/period-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/period-chooser.js.es6 @@ -16,18 +16,18 @@ export default DropdownSelectBoxComponent.extend({ @on("didUpdateAttrs", "init") _setFullDay() { - this.get("headerComponentOptions").setProperties({ - fullDay: this.get("fullDay") + this.headerComponentOptions.setProperties({ + fullDay: this.fullDay }); - this.get("rowComponentOptions").setProperties({ - fullDay: this.get("fullDay") + this.rowComponentOptions.setProperties({ + fullDay: this.fullDay }); }, actions: { onSelect() { if (this.action) { - this.action(this.get("computedValue")); + this.action(this.computedValue); } } } diff --git a/app/assets/javascripts/select-kit/components/pinned-options.js.es6 b/app/assets/javascripts/select-kit/components/pinned-options.js.es6 index e13925701d3..a560bff74da 100644 --- a/app/assets/javascripts/select-kit/components/pinned-options.js.es6 +++ b/app/assets/javascripts/select-kit/components/pinned-options.js.es6 @@ -12,7 +12,7 @@ export default DropdownSelectBoxComponent.extend({ computeHeaderContent() { let content = this._super(...arguments); const pinnedGlobally = this.get("topic.pinned_globally"); - const pinned = this.get("computedValue"); + const pinned = this.computedValue; const globally = pinnedGlobally ? "_globally" : ""; const state = pinned ? `pinned${globally}` : "unpinned"; const title = I18n.t(`topic_statuses.${state}.title`); @@ -46,9 +46,9 @@ export default DropdownSelectBoxComponent.extend({ actions: { onSelect() { - const topic = this.get("topic"); + const topic = this.topic; - if (this.get("computedValue") === "unpinned") { + if (this.computedValue === "unpinned") { topic.clearPin(); } else { topic.rePin(); diff --git a/app/assets/javascripts/select-kit/components/search-advanced-category-chooser.js.es6 b/app/assets/javascripts/select-kit/components/search-advanced-category-chooser.js.es6 index fe49dbca6c9..831507a3b8b 100644 --- a/app/assets/javascripts/select-kit/components/search-advanced-category-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/search-advanced-category-chooser.js.es6 @@ -13,7 +13,7 @@ export default CategoryChooserComponent.extend({ init() { this._super(...arguments); - this.get("rowComponentOptions").setProperties({ + this.rowComponentOptions.setProperties({ displayCategoryDescription: false }); }, diff --git a/app/assets/javascripts/select-kit/components/select-kit.js.es6 b/app/assets/javascripts/select-kit/components/select-kit.js.es6 index aa620ad0245..d71651b8d55 100644 --- a/app/assets/javascripts/select-kit/components/select-kit.js.es6 +++ b/app/assets/javascripts/select-kit/components/select-kit.js.es6 @@ -86,36 +86,36 @@ export default Ember.Component.extend( this.noneValue = "__none__"; this.set( "headerComponentOptions", - Ember.Object.create({ forceEscape: this.get("forceEscape") }) + Ember.Object.create({ forceEscape: this.forceEscape }) ); this.set( "rowComponentOptions", Ember.Object.create({ - forceEscape: this.get("forceEscape") + forceEscape: this.forceEscape }) ); this.set("computedContent", []); this.set("highlightedSelection", []); - if (this.get("nameChanges")) { + if (this.nameChanges) { this.addObserver( - `content.@each.${this.get("nameProperty")}`, + `content.@each.${this.nameProperty}`, this, this._compute ); } - if (this.get("allowContentReplacement")) { + if (this.allowContentReplacement) { this.addObserver(`content.[]`, this, this._compute); } - if (this.get("isAsync")) { + if (this.isAsync) { this.addObserver(`asyncContent.[]`, this, this._compute); } }, keyDown(event) { - if (!isEmpty(this.get("filter"))) return true; + if (!isEmpty(this.filter)) return true; const keyCode = event.keyCode || event.which; @@ -132,7 +132,7 @@ export default Ember.Component.extend( willDestroyElement() { this.removeObserver( - `content.@each.${this.get("nameProperty")}`, + `content.@each.${this.nameProperty}`, this, "_compute" ); @@ -145,7 +145,7 @@ export default Ember.Component.extend( willComputeContent(content) { return applyContentPluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, content, this ); @@ -155,8 +155,8 @@ export default Ember.Component.extend( }, _beforeDidComputeContent(content) { let existingCreatedComputedContent = []; - if (!this.get("allowContentReplacement")) { - existingCreatedComputedContent = this.get("computedContent").filterBy( + if (!this.allowContentReplacement) { + existingCreatedComputedContent = this.computedContent.filterBy( "created", true ); @@ -179,7 +179,7 @@ export default Ember.Component.extend( }, _beforeDidComputeAsyncContent(content) { content = applyContentPluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, content, this ); @@ -197,8 +197,8 @@ export default Ember.Component.extend( if (typeof contentItem === "string" || typeof contentItem === "number") { originalContent = {}; - originalContent[this.get("valueAttribute")] = contentItem; - originalContent[this.get("nameProperty")] = name || contentItem; + originalContent[this.valueAttribute] = contentItem; + originalContent[this.nameProperty] = name || contentItem; } else { originalContent = contentItem; } @@ -241,11 +241,11 @@ export default Ember.Component.extend( }, validateCreate(created) { - return !this.get("hasReachedMaximum") && created.length > 0; + return !this.hasReachedMaximum && created.length > 0; }, validateSelect() { - return !this.get("hasReachedMaximum"); + return !this.hasReachedMaximum; }, @computed("maximum", "selection.[]") @@ -276,24 +276,20 @@ export default Ember.Component.extend( collectionComputedContent.length === 0 && !isLoading ) { - return ( - this.get("termMatchErrorMessage") || I18n.t("select_kit.no_content") - ); + return this.termMatchErrorMessage || I18n.t("select_kit.no_content"); } }, @computed("hasReachedMaximum", "hasReachedMinimum", "isExpanded") validationMessage(hasReachedMaximum, hasReachedMinimum) { - if (hasReachedMaximum && this.get("maximum")) { - const key = - this.get("maximumLabel") || "select_kit.max_content_reached"; - return I18n.t(key, { count: this.get("maximum") }); + if (hasReachedMaximum && this.maximum) { + const key = this.maximumLabel || "select_kit.max_content_reached"; + return I18n.t(key, { count: this.maximum }); } - if (!hasReachedMinimum && this.get("minimum")) { - const key = - this.get("minimumLabel") || "select_kit.min_content_not_reached"; - return I18n.t(key, { count: this.get("minimum") }); + if (!hasReachedMinimum && this.minimum) { + const key = this.minimumLabel || "select_kit.min_content_not_reached"; + return I18n.t(key, { count: this.minimum }); } }, @@ -329,7 +325,7 @@ export default Ember.Component.extend( if (isLoading || hasReachedMaximum) return false; if (collectionComputedContent.map(c => c.value).includes(filter)) return false; - if (this.get("allowAny") && this.validateCreate(filter)) return true; + if (this.allowAny && this.validateCreate(filter)) return true; return false; }, @@ -432,8 +428,8 @@ export default Ember.Component.extend( @computed("selection.[]", "isExpanded", "filter", "highlightedSelection.[]") collectionHeaderComputedContent() { return applyCollectionHeaderCallbacks( - this.get("pluginApiIdentifiers"), - this.get("collectionHeader"), + this.pluginApiIdentifiers, + this.collectionHeader, this ); }, @@ -441,7 +437,7 @@ export default Ember.Component.extend( @computed("selection.[]", "isExpanded", "headerIcon") headerComputedContent() { return applyHeaderContentPluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, this.computeHeaderContent(), this ); @@ -461,7 +457,7 @@ export default Ember.Component.extend( }, clearSelection() { - this.deselect(this.get("selection")); + this.deselect(this.selection); this.focusFilterOrHeader(); this.didClearSelection(); }, @@ -470,7 +466,7 @@ export default Ember.Component.extend( onToggle() { this.clearHighlightSelection(); - if (this.get("isExpanded")) { + if (this.isExpanded) { this.collapse(); } else { this.expand(); @@ -494,7 +490,7 @@ export default Ember.Component.extend( }, onFilterComputedContent(filter) { - if (filter === this.get("previousFilter")) return; + if (filter === this.previousFilter) return; this.clearHighlightSelection(); diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 index 6cac14250b0..330baedff79 100644 --- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 +++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 @@ -53,14 +53,14 @@ export default Ember.Component.extend(UtilsMixin, { @on("didReceiveAttrs") _setSelectionState() { this.setProperties({ - isSelected: this.get("computedValue") === this.get("value"), - isHighlighted: this.get("highlighted.value") === this.get("value") + isSelected: this.computedValue === this.value, + isHighlighted: this.get("highlighted.value") === this.value }); }, @on("willDestroyElement") _clearDebounce() { - const hoverDebounce = this.get("hoverDebounce"); + const hoverDebounce = this.hoverDebounce; if (isPresent(hoverDebounce)) { run.cancel(hoverDebounce); } @@ -86,10 +86,10 @@ export default Ember.Component.extend(UtilsMixin, { }, click() { - this.onClickRow(this.get("computedContent")); + this.onClickRow(this.computedContent); }, _sendMouseoverAction() { - this.onMouseoverRow(this.get("computedContent")); + this.onMouseoverRow(this.computedContent); } }); diff --git a/app/assets/javascripts/select-kit/components/single-select.js.es6 b/app/assets/javascripts/select-kit/components/single-select.js.es6 index 4d8f9b9b273..0e659e45451 100644 --- a/app/assets/javascripts/select-kit/components/single-select.js.es6 +++ b/app/assets/javascripts/select-kit/components/single-select.js.es6 @@ -22,11 +22,11 @@ export default SelectKitComponent.extend({ _compute() { run.scheduleOnce("afterRender", () => { this.willComputeAttributes(); - let content = this.get("content") || []; - let asyncContent = this.get("asyncContent") || []; + let content = this.content || []; + let asyncContent = this.asyncContent || []; content = this.willComputeContent(content); asyncContent = this.willComputeAsyncContent(asyncContent); - let value = this._beforeWillComputeValue(this.get("value")); + let value = this._beforeWillComputeValue(this.value); content = this.computeContent(content); asyncContent = this.computeAsyncContent(asyncContent); content = this._beforeDidComputeContent(content); @@ -39,16 +39,16 @@ export default SelectKitComponent.extend({ this.didComputeValue(value); this.didComputeAttributes(); - if (this.get("allowInitialValueMutation")) this.mutateAttributes(); + if (this.allowInitialValueMutation) this.mutateAttributes(); }); }, mutateAttributes() { run.next(() => { - if (this.get("isDestroyed") || this.get("isDestroying")) return; + if (this.isDestroyed || this.isDestroying) return; - this.mutateContent(this.get("computedContent")); - this.mutateValue(this.get("computedValue")); + this.mutateContent(this.computedContent); + this.mutateValue(this.computedValue); }); }, mutateContent() {}, @@ -63,12 +63,12 @@ export default SelectKitComponent.extend({ _beforeWillComputeValue(value) { if ( - !isEmpty(this.get("content")) && + !isEmpty(this.content) && isEmpty(value) && - isNone(this.get("none")) && - this.get("allowAutoSelectFirst") + isNone(this.none) && + this.allowAutoSelectFirst ) { - value = this.valueForContentItem(get(this.get("content"), "firstObject")); + value = this.valueForContentItem(get(this.content, "firstObject")); } switch (typeof value) { @@ -101,15 +101,15 @@ export default SelectKitComponent.extend({ computeHeaderContent() { let content = { - title: this.get("title"), + title: this.title, icons: makeArray(this.getWithDefault("headerIcon", [])), value: this.get("selection.value"), name: this.get("selection.name") || this.get("noneRowComputedContent.name") }; - if (this.get("noneLabel") && !this.get("hasSelection")) { - content.title = content.name = I18n.t(this.get("noneLabel")); + if (this.noneLabel && !this.hasSelection) { + content.title = content.name = I18n.t(this.noneLabel); } return content; @@ -121,8 +121,8 @@ export default SelectKitComponent.extend({ return computedValue !== get(c, "value"); }); - if (this.get("limitMatches")) { - return computedAsyncContent.slice(0, this.get("limitMatches")); + if (this.limitMatches) { + return computedAsyncContent.slice(0, this.limitMatches); } return computedAsyncContent; @@ -143,8 +143,8 @@ export default SelectKitComponent.extend({ ); } - if (this.get("limitMatches")) { - return computedContent.slice(0, this.get("limitMatches")); + if (this.limitMatches) { + return computedContent.slice(0, this.limitMatches); } return computedContent; @@ -158,7 +158,7 @@ export default SelectKitComponent.extend({ @computed("selection") hasSelection(selection) { return ( - selection !== this.get("noneRowComputedContent") && !isNone(selection) + selection !== this.noneRowComputedContent && !isNone(selection) ); }, @@ -175,40 +175,40 @@ export default SelectKitComponent.extend({ autoHighlight() { run.schedule("afterRender", () => { - if (this.get("shouldDisplayCreateRow")) { - this.highlight(this.get("createRowComputedContent")); + if (this.shouldDisplayCreateRow) { + this.highlight(this.createRowComputedContent); return; } if ( - !isEmpty(this.get("filter")) && - !isEmpty(this.get("collectionComputedContent")) + !isEmpty(this.filter) && + !isEmpty(this.collectionComputedContent) ) { this.highlight(this.get("collectionComputedContent.firstObject")); return; } if ( - !this.get("isAsync") && - this.get("hasSelection") && - isEmpty(this.get("filter")) + !this.isAsync && + this.hasSelection && + isEmpty(this.filter) ) { - this.highlight(get(makeArray(this.get("selection")), "firstObject")); + this.highlight(get(makeArray(this.selection), "firstObject")); return; } if ( - !this.get("isAsync") && - !this.get("hasSelection") && - isEmpty(this.get("filter")) && - !isEmpty(this.get("collectionComputedContent")) + !this.isAsync && + !this.hasSelection && + isEmpty(this.filter) && + !isEmpty(this.collectionComputedContent) ) { this.highlight(this.get("collectionComputedContent.firstObject")); return; } - if (isPresent(this.get("noneRowComputedContent"))) { - this.highlight(this.get("noneRowComputedContent")); + if (isPresent(this.noneRowComputedContent)) { + this.highlight(this.noneRowComputedContent); return; } }); @@ -217,7 +217,7 @@ export default SelectKitComponent.extend({ select(computedContentItem) { if (computedContentItem.__sk_row_type === "noopRow") { applyOnSelectPluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, computedContentItem.value, this ); @@ -227,7 +227,7 @@ export default SelectKitComponent.extend({ return; } - if (this.get("hasSelection")) { + if (this.hasSelection) { this.deselect(this.get("selection.value")); } @@ -236,7 +236,7 @@ export default SelectKitComponent.extend({ computedContentItem.__sk_row_type === "noneRow" ) { applyOnSelectNonePluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, this ); this._boundaryActionHandler("onSelectNone"); @@ -247,12 +247,12 @@ export default SelectKitComponent.extend({ if (computedContentItem.__sk_row_type === "createRow") { if ( - this.get("computedValue") !== computedContentItem.value && + this.computedValue !== computedContentItem.value && this.validateCreate(computedContentItem.value) ) { this.willCreate(computedContentItem); computedContentItem.__sk_row_type = null; - this.get("computedContent").pushObject(computedContentItem); + this.computedContent.pushObject(computedContentItem); run.schedule("afterRender", () => { this.didCreate(computedContentItem); @@ -287,7 +287,7 @@ export default SelectKitComponent.extend({ this.didSelect(computedContentItem); applyOnSelectPluginApiCallbacks( - this.get("pluginApiIdentifiers"), + this.pluginApiIdentifiers, computedContentItem.value, this ); diff --git a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 index 2d9fe9ae88a..e55773850f0 100644 --- a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 @@ -19,11 +19,11 @@ export default MultiSelectComponent.extend(TagsMixin, { init() { this._super(...arguments); - if (this.get("allowCreate") !== false) { + if (this.allowCreate !== false) { this.set("allowCreate", this.site.get("can_create_tag")); } - if (!this.get("blacklist")) { + if (!this.blacklist) { this.set("blacklist", []); } @@ -38,12 +38,12 @@ export default MultiSelectComponent.extend(TagsMixin, { }); }); - if (!this.get("unlimitedTagCount")) { + if (!this.unlimitedTagCount) { this.set( "maximum", parseInt( - this.get("limit") || - this.get("maximum") || + this.limit || + this.maximum || this.get("siteSettings.max_tags_per_topic") ) ); @@ -76,41 +76,41 @@ export default MultiSelectComponent.extend(TagsMixin, { onExpand() { this.set( "searchDebounce", - run.debounce(this, this._prepareSearch, this.get("filter"), 200) + run.debounce(this, this._prepareSearch, this.filter, 200) ); }, onDeselect() { this.set( "searchDebounce", - run.debounce(this, this._prepareSearch, this.get("filter"), 200) + run.debounce(this, this._prepareSearch, this.filter, 200) ); }, onSelect() { this.set( "searchDebounce", - run.debounce(this, this._prepareSearch, this.get("filter"), 50) + run.debounce(this, this._prepareSearch, this.filter, 50) ); } }, _prepareSearch(query) { - const selectedTags = makeArray(this.get("values")).filter(t => t); + const selectedTags = makeArray(this.values).filter(t => t); const data = { q: query, limit: this.get("siteSettings.max_tag_search_results"), - categoryId: this.get("categoryId") + categoryId: this.categoryId }; - if (selectedTags.length || this.get("blacklist").length) { + if (selectedTags.length || this.blacklist.length) { data.selected_tags = _.uniq( - selectedTags.concat(this.get("blacklist")) + selectedTags.concat(this.blacklist) ).slice(0, 100); } - if (!this.get("everyTag")) data.filterForInput = true; + if (!this.everyTag) data.filterForInput = true; this.searchTags("/tags/filter/search", data, this._transformJson); }, diff --git a/app/assets/javascripts/select-kit/components/tag-drop.js.es6 b/app/assets/javascripts/select-kit/components/tag-drop.js.es6 index 52c235efed0..d88ec1614c5 100644 --- a/app/assets/javascripts/select-kit/components/tag-drop.js.es6 +++ b/app/assets/javascripts/select-kit/components/tag-drop.js.es6 @@ -26,7 +26,7 @@ export default ComboBoxComponent.extend(TagsMixin, { @computed("tagId") noTagsSelected() { - return this.get("tagId") === "none"; + return this.tagId === "none"; }, @computed("showFilterByTag", "content") @@ -44,16 +44,16 @@ export default ComboBoxComponent.extend(TagsMixin, { let content = this._super(...arguments); if (!content.value) { - if (this.get("tagId")) { - if (this.get("tagId") === "none") { - content.title = this.get("noTagsLabel"); + if (this.tagId) { + if (this.tagId === "none") { + content.title = this.noTagsLabel; } else { - content.title = this.get("tagId"); + content.title = this.tagId; } - } else if (this.get("noTagsSelected")) { - content.title = this.get("noTagsLabel"); + } else if (this.noTagsSelected) { + content.title = this.noTagsLabel; } else { - content.title = this.get("allTagsLabel"); + content.title = this.allTagsLabel; } } else { content.title = content.value; @@ -69,7 +69,7 @@ export default ComboBoxComponent.extend(TagsMixin, { @computed("firstCategory", "secondCategory") allTagsUrl() { - if (this.get("currentCategory")) { + if (this.currentCategory) { return Discourse.getURL(this.get("currentCategory.url") + "?allTags=1"); } else { return Discourse.getURL("/"); @@ -79,7 +79,7 @@ export default ComboBoxComponent.extend(TagsMixin, { @computed("firstCategory", "secondCategory") noTagsUrl() { var url = "/tags"; - if (this.get("currentCategory")) { + if (this.currentCategory) { url += this.get("currentCategory.url"); } return Discourse.getURL(`${url}/none`); @@ -150,12 +150,12 @@ export default ComboBoxComponent.extend(TagsMixin, { let url; if (tagId === "all-tags") { - url = Discourse.getURL(this.get("allTagsUrl")); + url = Discourse.getURL(this.allTagsUrl); } else if (tagId === "no-tags") { - url = Discourse.getURL(this.get("noTagsUrl")); + url = Discourse.getURL(this.noTagsUrl); } else { url = "/tags"; - if (this.get("currentCategory")) { + if (this.currentCategory) { url += this.get("currentCategory.url"); } url = Discourse.getURL(`${url}/${tagId.toLowerCase()}`); @@ -165,14 +165,14 @@ export default ComboBoxComponent.extend(TagsMixin, { }, onExpand() { - if (isEmpty(this.get("asyncContent"))) { - this.set("asyncContent", this.get("content")); + if (isEmpty(this.asyncContent)) { + this.set("asyncContent", this.content); } }, onFilter(filter) { if (isEmpty(filter)) { - this.set("asyncContent", this.get("content")); + this.set("asyncContent", this.content); return; } diff --git a/app/assets/javascripts/select-kit/components/tag-group-chooser.js.es6 b/app/assets/javascripts/select-kit/components/tag-group-chooser.js.es6 index c0f7b8492ab..c3cb9d0ef30 100644 --- a/app/assets/javascripts/select-kit/components/tag-group-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/tag-group-chooser.js.es6 @@ -49,10 +49,10 @@ export default MultiSelectComponent.extend(TagsMixin, { }, onExpand() { - if (isEmpty(this.get("collectionComputedContent"))) { + if (isEmpty(this.collectionComputedContent)) { this.set( "searchDebounce", - run.debounce(this, this._prepareSearch, this.get("filter"), 200) + run.debounce(this, this._prepareSearch, this.filter, 200) ); } }, @@ -60,14 +60,14 @@ export default MultiSelectComponent.extend(TagsMixin, { onDeselect() { this.set( "searchDebounce", - run.debounce(this, this._prepareSearch, this.get("filter"), 200) + run.debounce(this, this._prepareSearch, this.filter, 200) ); }, onSelect() { this.set( "searchDebounce", - run.debounce(this, this._prepareSearch, this.get("filter"), 50) + run.debounce(this, this._prepareSearch, this.filter, 50) ); } }, diff --git a/app/assets/javascripts/select-kit/components/tag-notifications-button.js.es6 b/app/assets/javascripts/select-kit/components/tag-notifications-button.js.es6 index b9772c1199f..12aef37fac0 100644 --- a/app/assets/javascripts/select-kit/components/tag-notifications-button.js.es6 +++ b/app/assets/javascripts/select-kit/components/tag-notifications-button.js.es6 @@ -13,7 +13,7 @@ export default NotificationOptionsComponent.extend({ }, computeValue() { - return this.get("notificationLevel"); + return this.notificationLevel; }, @computed("iconForSelectedDetails") diff --git a/app/assets/javascripts/select-kit/components/topic-notifications-options.js.es6 b/app/assets/javascripts/select-kit/components/topic-notifications-options.js.es6 index 5e04fe0771a..e59e5d5d341 100644 --- a/app/assets/javascripts/select-kit/components/topic-notifications-options.js.es6 +++ b/app/assets/javascripts/select-kit/components/topic-notifications-options.js.es6 @@ -18,7 +18,7 @@ export default NotificationOptionsComponent.extend({ }, _changed(msg) { - if (this.get("computedValue") !== msg.id) { + if (this.computedValue !== msg.id) { this.get("topic.details").updateNotifications(msg.id); } }, @@ -34,7 +34,7 @@ export default NotificationOptionsComponent.extend({ }, mutateValue(value) { - if (value !== this.get("value")) { + if (value !== this.value) { this.get("topic.details").updateNotifications(value); } }, diff --git a/app/assets/javascripts/select-kit/components/user-notifications-dropdown.js.es6 b/app/assets/javascripts/select-kit/components/user-notifications-dropdown.js.es6 index 0d31bfc1fe9..f9060e99d00 100644 --- a/app/assets/javascripts/select-kit/components/user-notifications-dropdown.js.es6 +++ b/app/assets/javascripts/select-kit/components/user-notifications-dropdown.js.es6 @@ -48,7 +48,7 @@ export default DropdownSelectBox.extend({ }, changeToNormal() { - this.get("updateNotificationLevel")("normal") + this.updateNotificationLevel("normal") .then(() => { this.set("user.ignored", false); this.set("user.muted", false); @@ -57,7 +57,7 @@ export default DropdownSelectBox.extend({ .catch(popupAjaxError); }, changeToMuted() { - this.get("updateNotificationLevel")("mute") + this.updateNotificationLevel("mute") .then(() => { this.set("user.ignored", false); this.set("user.muted", true); @@ -67,7 +67,7 @@ export default DropdownSelectBox.extend({ }, changeToIgnored() { const controller = showModal("ignore-duration", { - model: this.get("user") + model: this.user }); controller.setProperties({ onSuccess: () => { diff --git a/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6 b/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6 index e01cfbbb2e4..a0faea34e4c 100644 --- a/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6 +++ b/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6 @@ -115,7 +115,7 @@ export default Ember.Mixin.create({ }, expand() { - if (this.get("isExpanded")) return; + if (this.isExpanded) return; this.setProperties({ isExpanded: true, @@ -136,7 +136,7 @@ export default Ember.Mixin.create({ }, collapse() { - if (!this.get("isExpanded")) return; + if (!this.isExpanded) return; this.set("isExpanded", false); @@ -153,7 +153,7 @@ export default Ember.Mixin.create({ // lose focus of the component in two steps // first collapse and keep focus and then remove focus unfocus(event) { - if (this.get("isExpanded")) { + if (this.isExpanded) { this.collapse(event); this.focus(event); } else { @@ -175,13 +175,13 @@ export default Ember.Mixin.create({ this._computedStyle(discourseHeader, "height") : 0; const bodyHeight = this._computedStyle(this.$body()[0], "height"); - const componentHeight = this._computedStyle(this.get("element"), "height"); - const offsetTop = this.get("element").getBoundingClientRect().top; - const offsetBottom = this.get("element").getBoundingClientRect().bottom; + const componentHeight = this._computedStyle(this.element, "height"); + const offsetTop = this.element.getBoundingClientRect().top; + const offsetBottom = this.element.getBoundingClientRect().bottom; const windowWidth = $(window).width(); if ( - this.get("fullWidthOnMobile") && + this.fullWidthOnMobile && (this.site && this.site.isMobileDevice) ) { const margin = 10; @@ -200,12 +200,12 @@ export default Ember.Mixin.create({ spaceToLeftEdge = this.$().offset().left - this.$scrollableParent().offset().left; } else { - spaceToLeftEdge = this.get("element").getBoundingClientRect().left; + spaceToLeftEdge = this.element.getBoundingClientRect().left; } let isLeftAligned = true; const spaceToRightEdge = parentWidth - spaceToLeftEdge; - const elementWidth = this.get("element").getBoundingClientRect().width; + const elementWidth = this.element.getBoundingClientRect().width; if (spaceToRightEdge > spaceToLeftEdge + elementWidth) { isLeftAligned = false; } @@ -216,10 +216,10 @@ export default Ember.Mixin.create({ .removeClass("is-right-aligned"); if (this._isRTL()) { - options.right = this.get("horizontalOffset"); + options.right = this.horizontalOffset; } else { options.left = - -bodyWidth + elementWidth - this.get("horizontalOffset"); + -bodyWidth + elementWidth - this.horizontalOffset; } } else { this.$() @@ -228,15 +228,15 @@ export default Ember.Mixin.create({ if (this._isRTL()) { options.right = - -bodyWidth + elementWidth - this.get("horizontalOffset"); + -bodyWidth + elementWidth - this.horizontalOffset; } else { - options.left = this.get("horizontalOffset"); + options.left = this.horizontalOffset; } } } const fullHeight = - this.get("verticalOffset") + bodyHeight + componentHeight; + this.verticalOffset + bodyHeight + componentHeight; const hasBelowSpace = $(window).height() - offsetBottom - fullHeight >= -1; const hasAboveSpace = offsetTop - fullHeight - discourseHeaderHeight >= -1; const headerHeight = this._computedStyle(this.$header()[0], "height"); @@ -245,24 +245,24 @@ export default Ember.Mixin.create({ this.$() .addClass("is-below") .removeClass("is-above"); - options.top = headerHeight + this.get("verticalOffset"); + options.top = headerHeight + this.verticalOffset; } else { this.$() .addClass("is-above") .removeClass("is-below"); - options.bottom = headerHeight + this.get("verticalOffset"); + options.bottom = headerHeight + this.verticalOffset; } this.$body().css(options); }, _applyFixedPosition() { - if (this.get("isExpanded") !== true) return; + if (this.isExpanded !== true) return; if (this.$fixedPlaceholder().length) return; if (!this.$scrollableParent().length) return; - const width = this._computedStyle(this.get("element"), "width"); - const height = this._computedStyle(this.get("element"), "height"); + const width = this._computedStyle(this.element, "width"); + const height = this._computedStyle(this.element, "height"); this._previousScrollParentOverflow = this._previousScrollParentOverflow || @@ -280,9 +280,9 @@ export default Ember.Mixin.create({ }; const componentStyles = { - top: this.get("element").getBoundingClientRect().top, + top: this.element.getBoundingClientRect().top, width, - left: this.get("element").getBoundingClientRect().left, + left: this.element.getBoundingClientRect().left, marginLeft: 0, marginRight: 0, minWidth: "unset", @@ -322,7 +322,7 @@ export default Ember.Mixin.create({ }, _positionWrapper() { - const elementWidth = this._computedStyle(this.get("element"), "width"); + const elementWidth = this._computedStyle(this.element, "width"); const headerHeight = this._computedStyle(this.$header()[0], "height"); const bodyHeight = this._computedStyle(this.$body()[0], "height"); diff --git a/app/assets/javascripts/select-kit/mixins/events.js.es6 b/app/assets/javascripts/select-kit/mixins/events.js.es6 index 7c8ac46684e..39d67435489 100644 --- a/app/assets/javascripts/select-kit/mixins/events.js.es6 +++ b/app/assets/javascripts/select-kit/mixins/events.js.es6 @@ -47,8 +47,8 @@ export default Ember.Mixin.create({ if (Ember.$.contains(this.element, event.target)) { event.stopPropagation(); - if (!this.get("renderedBodyOnce")) return; - if (!this.get("isFocused")) return; + if (!this.renderedBodyOnce) return; + if (!this.isFocused) return; } else { this.didClickOutside(event); } @@ -58,7 +58,7 @@ export default Ember.Mixin.create({ this.$header() .on("blur.select-kit", () => { - if (!this.get("isExpanded") && this.get("isFocused")) { + if (!this.isExpanded && this.isFocused) { this.close(); } }) @@ -76,17 +76,14 @@ export default Ember.Mixin.create({ } if (keyCode === this.keys.TAB && !event.shiftKey) this.tabFromHeader(event); - if ( - Ember.isEmpty(this.get("filter")) && - keyCode === this.keys.BACKSPACE - ) + if (Ember.isEmpty(this.filter) && keyCode === this.keys.BACKSPACE) this.backspaceFromHeader(event); if (keyCode === this.keys.ESC) this.escapeFromHeader(event); if (keyCode === this.keys.ENTER) this.enterFromHeader(event); if ([this.keys.UP, this.keys.DOWN].includes(keyCode)) this.upAndDownFromHeader(event); if ( - Ember.isEmpty(this.get("filter")) && + Ember.isEmpty(this.filter) && [this.keys.LEFT, this.keys.RIGHT].includes(keyCode) ) { this.leftAndRightFromHeader(event); @@ -101,7 +98,7 @@ export default Ember.Mixin.create({ this.expand(event); - if (this.get("filterable") || this.get("autoFilterable")) { + if (this.filterable || this.autoFilterable) { this.set("renderedFilterOnce", true); } @@ -128,7 +125,7 @@ export default Ember.Mixin.create({ const keyCode = event.keyCode || event.which; if ( - Ember.isEmpty(this.get("filter")) && + Ember.isEmpty(this.filter) && keyCode === this.keys.BACKSPACE && typeof this.didPressBackspaceFromFilter === "function" ) { @@ -146,7 +143,7 @@ export default Ember.Mixin.create({ this.upAndDownFromFilter(event); if ( - Ember.isEmpty(this.get("filter")) && + Ember.isEmpty(this.filter) && [this.keys.LEFT, this.keys.RIGHT].includes(keyCode) ) { this.leftAndRightFromFilter(event); @@ -155,7 +152,7 @@ export default Ember.Mixin.create({ }, didPressTab(event) { - if (this.$highlightedRow().length && this.get("isExpanded")) { + if (this.$highlightedRow().length && this.isExpanded) { this.close(event); this.$header().focus(); const guid = this.$highlightedRow().attr("data-guid"); @@ -163,7 +160,7 @@ export default Ember.Mixin.create({ return true; } - if (Ember.isEmpty(this.get("filter"))) { + if (Ember.isEmpty(this.filter)) { this.close(event); return true; } @@ -172,7 +169,7 @@ export default Ember.Mixin.create({ }, didPressEnter(event) { - if (!this.get("isExpanded")) { + if (!this.isExpanded) { this.expand(event); } else if (this.$highlightedRow().length) { this.close(event); @@ -198,7 +195,7 @@ export default Ember.Mixin.create({ didPressEscape(event) { this._destroyEvent(event); - if (this.get("highlightedSelection").length && this.get("isExpanded")) { + if (this.highlightedSelection.length && this.isExpanded) { this.clearHighlightSelection(); } else { this.unfocus(event); @@ -212,7 +209,7 @@ export default Ember.Mixin.create({ const keyCode = event.keyCode || event.which; - if (!this.get("isExpanded")) { + if (!this.isExpanded) { this.expand(event); if (this.$selectedRow().length === 1) { @@ -243,7 +240,7 @@ export default Ember.Mixin.create({ this.didPressBackspace(event); }, didPressBackspace(event) { - if (!this.get("isExpanded")) { + if (!this.isExpanded) { this.expand(); if (event) event.stopImmediatePropagation(); return; @@ -251,14 +248,14 @@ export default Ember.Mixin.create({ if (!this.selection || !this.selection.length) return; - if (!Ember.isEmpty(this.get("filter"))) { + if (!Ember.isEmpty(this.filter)) { this.clearHighlightSelection(); return; } - if (!this.get("highlightedSelection").length) { + if (!this.highlightedSelection.length) { // try to highlight the last non locked item from the current selection - Ember.makeArray(this.get("selection")) + Ember.makeArray(this.selection) .slice() .reverse() .some(selection => { @@ -270,20 +267,17 @@ export default Ember.Mixin.create({ if (event) event.stopImmediatePropagation(); } else { - this.deselect(this.get("highlightedSelection")); + this.deselect(this.highlightedSelection); if (event) event.stopImmediatePropagation(); } }, didPressSelectAll() { - this.highlightSelection(Ember.makeArray(this.get("selection"))); + this.highlightSelection(Ember.makeArray(this.selection)); }, didClickOutside(event) { - if ( - this.get("isExpanded") && - $(event.target).parents(".select-kit").length - ) { + if (this.isExpanded && $(event.target).parents(".select-kit").length) { this.close(event); return false; } @@ -299,31 +293,31 @@ export default Ember.Mixin.create({ }, didPressLeftAndRightArrows(event) { - if (!this.get("isExpanded")) { + if (!this.isExpanded) { this.expand(); event.stopImmediatePropagation(); return; } - if (Ember.isEmpty(this.get("selection"))) return; + if (Ember.isEmpty(this.selection)) return; const keyCode = event.keyCode || event.which; if (keyCode === this.keys.LEFT) { const prev = this.get("highlightedSelection.lastObject"); - const indexOfPrev = this.get("selection").indexOf(prev); + const indexOfPrev = this.selection.indexOf(prev); - if (this.get("selection")[indexOfPrev - 1]) { - this.highlightSelection(this.get("selection")[indexOfPrev - 1]); + if (this.selection[indexOfPrev - 1]) { + this.highlightSelection(this.selection[indexOfPrev - 1]); } else { this.highlightSelection(this.get("selection.lastObject")); } } else { const prev = this.get("highlightedSelection.firstObject"); - const indexOfNext = this.get("selection").indexOf(prev); + const indexOfNext = this.selection.indexOf(prev); - if (this.get("selection")[indexOfNext + 1]) { - this.highlightSelection(this.get("selection")[indexOfNext + 1]); + if (this.selection[indexOfNext + 1]) { + this.highlightSelection(this.selection[indexOfNext + 1]); } else { this.highlightSelection(this.get("selection.firstObject")); } diff --git a/app/assets/javascripts/select-kit/mixins/tags.js.es6 b/app/assets/javascripts/select-kit/mixins/tags.js.es6 index 3e4f3f9ad53..d409f636967 100644 --- a/app/assets/javascripts/select-kit/mixins/tags.js.es6 +++ b/app/assets/javascripts/select-kit/mixins/tags.js.es6 @@ -6,7 +6,7 @@ export default Ember.Mixin.create({ willDestroyElement() { this._super(...arguments); - const searchDebounce = this.get("searchDebounce"); + const searchDebounce = this.searchDebounce; if (searchDebounce) run.cancel(searchDebounce); }, @@ -28,7 +28,7 @@ export default Ember.Mixin.create({ }, validateCreate(term) { - if (this.get("hasReachedMaximum") || !this.site.get("can_create_tag")) { + if (this.hasReachedMaximum || !this.site.get("can_create_tag")) { return false; } @@ -38,7 +38,7 @@ export default Ember.Mixin.create({ .trim() .toLowerCase(); - if (!term.length || this.get("termMatchesForbidden")) { + if (!term.length || this.termMatchesForbidden) { return false; } @@ -50,11 +50,11 @@ export default Ember.Mixin.create({ return string === undefined ? undefined : string.toLowerCase(); }; - const inCollection = this.get("collectionComputedContent") + const inCollection = this.collectionComputedContent .map(c => toLowerCaseOrUndefined(get(c, "id"))) .includes(term); - const inSelection = this.get("selection") + const inSelection = this.selection .map(s => toLowerCaseOrUndefined(get(s, "value"))) .includes(term); diff --git a/app/assets/javascripts/select-kit/mixins/utils.js.es6 b/app/assets/javascripts/select-kit/mixins/utils.js.es6 index ef3120d3a3f..88fa9838f5d 100644 --- a/app/assets/javascripts/select-kit/mixins/utils.js.es6 +++ b/app/assets/javascripts/select-kit/mixins/utils.js.es6 @@ -7,7 +7,7 @@ export default Ember.Mixin.create({ case "number": return content; default: - return get(content, this.get("valueAttribute")); + return get(content, this.valueAttribute); } }, @@ -17,7 +17,7 @@ export default Ember.Mixin.create({ } if (typeof content === "object") { - return get(content, this.get("nameProperty")); + return get(content, this.nameProperty); } return content; @@ -44,7 +44,7 @@ export default Ember.Mixin.create({ _castBoolean(value) { if ( - this.get("castBoolean") && + this.castBoolean && Ember.isPresent(value) && typeof value === "string" ) { @@ -56,7 +56,7 @@ export default Ember.Mixin.create({ _castInteger(value) { if ( - this.get("castInteger") && + this.castInteger && Ember.isPresent(value) && this._isNumeric(value) ) { @@ -67,15 +67,15 @@ export default Ember.Mixin.create({ }, _findComputedContentItemByGuid(guid) { - if (guidFor(this.get("createRowComputedContent")) === guid) { - return this.get("createRowComputedContent"); + if (guidFor(this.createRowComputedContent) === guid) { + return this.createRowComputedContent; } - if (guidFor(this.get("noneRowComputedContent")) === guid) { - return this.get("noneRowComputedContent"); + if (guidFor(this.noneRowComputedContent) === guid) { + return this.noneRowComputedContent; } - return this.get("collectionComputedContent").find(c => { + return this.collectionComputedContent.find(c => { return guidFor(c) === guid; }); }, diff --git a/app/assets/javascripts/wizard/components/homepage-preview.js.es6 b/app/assets/javascripts/wizard/components/homepage-preview.js.es6 index 51574b24ed2..f92f7b04f3a 100644 --- a/app/assets/javascripts/wizard/components/homepage-preview.js.es6 +++ b/app/assets/javascripts/wizard/components/homepage-preview.js.es6 @@ -16,7 +16,7 @@ export default createPreviewComponent(659, 320, { images() { return { - logo: this.get("wizard").getLogoUrl(), + logo: this.wizard.getLogoUrl(), avatar: "/images/wizard/trout.png" }; }, diff --git a/app/assets/javascripts/wizard/components/image-preview-favicon.js.es6 b/app/assets/javascripts/wizard/components/image-preview-favicon.js.es6 index 226d5062915..91a72ecda70 100644 --- a/app/assets/javascripts/wizard/components/image-preview-favicon.js.es6 +++ b/app/assets/javascripts/wizard/components/image-preview-favicon.js.es6 @@ -22,7 +22,7 @@ export default createPreviewComponent(371, 124, { ctx.font = `20px 'Arial'`; ctx.fillStyle = "#000"; - let title = this.get("wizard").getTitle(); + let title = this.wizard.getTitle(); if (title.length > 20) { title = title.substring(0, 20) + "..."; } diff --git a/app/assets/javascripts/wizard/components/invite-list-user.js.es6 b/app/assets/javascripts/wizard/components/invite-list-user.js.es6 index a4adc100ca6..30ef3d178ac 100644 --- a/app/assets/javascripts/wizard/components/invite-list-user.js.es6 +++ b/app/assets/javascripts/wizard/components/invite-list-user.js.es6 @@ -5,6 +5,6 @@ export default Ember.Component.extend({ @computed("user.role") roleName(role) { - return this.get("roles").findBy("id", role).label; + return this.roles.findBy("id", role).label; } }); diff --git a/app/assets/javascripts/wizard/components/invite-list.js.es6 b/app/assets/javascripts/wizard/components/invite-list.js.es6 index ce0c3034d5f..585e91a892d 100644 --- a/app/assets/javascripts/wizard/components/invite-list.js.es6 +++ b/app/assets/javascripts/wizard/components/invite-list.js.es6 @@ -26,7 +26,7 @@ export default Ember.Component.extend({ }, updateField() { - const users = this.get("users"); + const users = this.users; this.set("field.value", JSON.stringify(users)); @@ -39,15 +39,15 @@ export default Ember.Component.extend({ actions: { addUser() { const user = { - email: this.get("inviteEmail") || "", - role: this.get("inviteRole") + email: this.inviteEmail || "", + role: this.inviteRole }; if (!/(.+)@(.+){2,}\.(.+){2,}/.test(user.email)) { return this.set("invalid", true); } - const users = this.get("users"); + const users = this.users; if (users.findBy("email", user.email)) { return this.set("invalid", true); } @@ -64,7 +64,7 @@ export default Ember.Component.extend({ }, removeUser(user) { - this.get("users").removeObject(user); + this.users.removeObject(user); this.updateField(); } } diff --git a/app/assets/javascripts/wizard/components/radio-button.js.es6 b/app/assets/javascripts/wizard/components/radio-button.js.es6 index 096165199a5..ff6f00e6cc2 100644 --- a/app/assets/javascripts/wizard/components/radio-button.js.es6 +++ b/app/assets/javascripts/wizard/components/radio-button.js.es6 @@ -5,13 +5,13 @@ export default Ember.Component.extend({ click(e) { e.preventDefault(); - this.onChange(this.get("radioValue")); + this.onChange(this.radioValue); }, @observes("value") @on("init") updateVal() { - const checked = this.get("value") === this.get("radioValue"); + const checked = this.value === this.radioValue; Ember.run.next(() => this.$("input[type=radio]").prop("checked", checked)); } }); diff --git a/app/assets/javascripts/wizard/components/theme-preview.js.es6 b/app/assets/javascripts/wizard/components/theme-preview.js.es6 index b5c408de9b9..2a098fb8796 100644 --- a/app/assets/javascripts/wizard/components/theme-preview.js.es6 +++ b/app/assets/javascripts/wizard/components/theme-preview.js.es6 @@ -20,7 +20,7 @@ export default createPreviewComponent(305, 165, { }, click() { - this.onChange(this.get("colorsId")); + this.onChange(this.colorsId); }, @observes("step.fieldsById.base_scheme_id.value") @@ -30,7 +30,7 @@ export default createPreviewComponent(305, 165, { images() { return { - logo: this.get("wizard").getLogoUrl(), + logo: this.wizard.getLogoUrl(), avatar: "/images/wizard/trout.png" }; }, diff --git a/app/assets/javascripts/wizard/components/wizard-step.js.es6 b/app/assets/javascripts/wizard/components/wizard-step.js.es6 index 6a655628836..38c47b2d909 100644 --- a/app/assets/javascripts/wizard/components/wizard-step.js.es6 +++ b/app/assets/javascripts/wizard/components/wizard-step.js.es6 @@ -69,7 +69,7 @@ export default Ember.Component.extend({ keyPress(key) { if (key.keyCode === 13) { - if (this.get("showDoneButton")) { + if (this.showDoneButton) { this.send("quit"); } else { this.send("nextStep"); @@ -110,7 +110,7 @@ export default Ember.Component.extend({ advance() { this.set("saving", true); - this.get("step") + this.step .save() .then(response => this.goNext(response)) .catch(() => this.animateInvalidFields()) @@ -123,7 +123,7 @@ export default Ember.Component.extend({ }, exitEarly() { - const step = this.get("step"); + const step = this.step; step.validate(); if (step.get("valid")) { @@ -141,7 +141,7 @@ export default Ember.Component.extend({ }, backStep() { - if (this.get("saving")) { + if (this.saving) { return; } @@ -149,11 +149,11 @@ export default Ember.Component.extend({ }, nextStep() { - if (this.get("saving")) { + if (this.saving) { return; } - const step = this.get("step"); + const step = this.step; const result = step.validate(); if (result.warnings.length) { diff --git a/app/assets/javascripts/wizard/lib/preview.js.es6 b/app/assets/javascripts/wizard/lib/preview.js.es6 index 476c2149d52..abf735ebde7 100644 --- a/app/assets/javascripts/wizard/lib/preview.js.es6 +++ b/app/assets/javascripts/wizard/lib/preview.js.es6 @@ -79,8 +79,8 @@ export function createPreviewComponent(width, height, obj) { return false; } - const colors = this.get("wizard").getCurrentColors( - this.get("colorsId") + const colors = this.wizard.getCurrentColors( + this.colorsId ); if (!colors) { return; diff --git a/app/assets/javascripts/wizard/models/step.js.es6 b/app/assets/javascripts/wizard/models/step.js.es6 index d465b553b46..c8c5fd1d623 100644 --- a/app/assets/javascripts/wizard/models/step.js.es6 +++ b/app/assets/javascripts/wizard/models/step.js.es6 @@ -19,7 +19,7 @@ export default Ember.Object.extend(ValidState, { let allValid = true; const result = { warnings: [] }; - this.get("fields").forEach(field => { + this.fields.forEach(field => { allValid = allValid && field.check(); const warning = field.get("warning"); if (warning) { @@ -33,7 +33,7 @@ export default Ember.Object.extend(ValidState, { }, fieldError(id, description) { - const field = this.get("fields").findBy("id", id); + const field = this.fields.findBy("id", id); if (field) { field.setValid(false, description); } @@ -41,10 +41,10 @@ export default Ember.Object.extend(ValidState, { save() { const fields = {}; - this.get("fields").forEach(f => (fields[f.id] = f.value)); + this.fields.forEach(f => (fields[f.id] = f.value)); return ajax({ - url: `/wizard/steps/${this.get("id")}`, + url: `/wizard/steps/${this.id}`, type: "PUT", data: { fields } }).catch(response => { diff --git a/app/assets/javascripts/wizard/models/wizard-field.js.es6 b/app/assets/javascripts/wizard/models/wizard-field.js.es6 index 0df8493847d..5ad88e26344 100644 --- a/app/assets/javascripts/wizard/models/wizard-field.js.es6 +++ b/app/assets/javascripts/wizard/models/wizard-field.js.es6 @@ -8,12 +8,12 @@ export default Ember.Object.extend(ValidState, { warning: null, check() { - if (!this.get("required")) { + if (!this.required) { this.setValid(true); return true; } - const val = this.get("value"); + const val = this.value; const valid = val && val.length > 0; this.setValid(valid); diff --git a/app/assets/javascripts/wizard/models/wizard.js.es6 b/app/assets/javascripts/wizard/models/wizard.js.es6 index d83ba58ef00..a4e65c6de1d 100644 --- a/app/assets/javascripts/wizard/models/wizard.js.es6 +++ b/app/assets/javascripts/wizard/models/wizard.js.es6 @@ -8,7 +8,7 @@ const Wizard = Ember.Object.extend({ totalSteps: length => length, getTitle() { - const titleStep = this.get("steps").findBy("id", "forum-title"); + const titleStep = this.steps.findBy("id", "forum-title"); if (!titleStep) { return; } @@ -16,7 +16,7 @@ const Wizard = Ember.Object.extend({ }, getLogoUrl() { - const logoStep = this.get("steps").findBy("id", "logos"); + const logoStep = this.steps.findBy("id", "logos"); if (!logoStep) { return; } @@ -25,7 +25,7 @@ const Wizard = Ember.Object.extend({ // A bit clunky, but get the current colors from the appropriate step getCurrentColors(schemeId) { - const colorStep = this.get("steps").findBy("id", "colors"); + const colorStep = this.steps.findBy("id", "colors"); if (!colorStep) { return; } diff --git a/plugins/discourse-details/assets/javascripts/initializers/apply-details.js.es6 b/plugins/discourse-details/assets/javascripts/initializers/apply-details.js.es6 index 3a360b7e8e2..246f88ec9be 100644 --- a/plugins/discourse-details/assets/javascripts/initializers/apply-details.js.es6 +++ b/plugins/discourse-details/assets/javascripts/initializers/apply-details.js.es6 @@ -14,7 +14,7 @@ function initializeDetails(api) { api.modifyClass("controller:composer", { actions: { insertDetails() { - this.get("toolbarEvent").applySurround( + this.toolbarEvent.applySurround( "\n" + `[details="${I18n.t("composer.details_title")}"]` + "\n", "\n[/details]\n", "details_text", diff --git a/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js.es6 b/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js.es6 index 2bde094eed5..8128bdfc805 100644 --- a/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js.es6 +++ b/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js.es6 @@ -49,7 +49,7 @@ export default Ember.Component.extend({ }, _renderPreview: debounce(function() { - const markup = this.get("markup"); + const markup = this.markup; if (markup) { cookAsync(markup).then(result => { @@ -104,7 +104,7 @@ export default Ember.Component.extend({ } let format = options.format; - if (timeInferred && this.get("formats").includes(format)) { + if (timeInferred && this.formats.includes(format)) { format = "LL"; } @@ -137,7 +137,7 @@ export default Ember.Component.extend({ } let format = options.format; - if (timeInferred && this.get("formats").includes(format)) { + if (timeInferred && this.formats.includes(format)) { format = "LL"; } @@ -342,11 +342,11 @@ export default Ember.Component.extend({ }, save() { - const markup = this.get("markup"); + const markup = this.markup; if (markup) { this._closeModal(); - this.get("toolbarEvent").addText(markup); + this.toolbarEvent.addText(markup); } }, @@ -376,7 +376,7 @@ export default Ember.Component.extend({ format: "YYYY-MM-DD", reposition: false, firstDay: 1, - defaultDate: moment(this.get("date"), this.dateFormat).toDate(), + defaultDate: moment(this.date, this.dateFormat).toDate(), setDefaultDate: true, keyboardInput: false, i18n: { @@ -389,11 +389,11 @@ export default Ember.Component.extend({ onSelect: date => { const formattedDate = moment(date).format("YYYY-MM-DD"); - if (this.get("fromSelected")) { + if (this.fromSelected) { this.set("date", formattedDate); } - if (this.get("toSelected")) { + if (this.toSelected) { this.set("toDate", formattedDate); } } diff --git a/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6 b/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6 index 2eb963b2770..bad4c859d8a 100644 --- a/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6 +++ b/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6 @@ -36,20 +36,20 @@ export default Ember.Component.extend({ @observes("reply", "title") typing() { if (new Date() - this._lastPublish > keepAliveDuration) { - this.publish({ current: this.get("currentState") }); + this.publish({ current: this.currentState }); } }, @on("willDestroyElement") composerClosing() { - this.publish({ previous: this.get("currentState") }); + this.publish({ previous: this.currentState }); Ember.run.cancel(this._pingTimer); Ember.run.cancel(this._clearTimer); }, updateState() { let state = null; - const action = this.get("action"); + const action = this.action; if (action === "reply" || action === "edit") { state = { action }; @@ -57,29 +57,29 @@ export default Ember.Component.extend({ if (action === "edit") state.post_id = this.get("post.id"); } - this.set("previousState", this.get("currentState")); + this.set("previousState", this.currentState); this.set("currentState", state); }, @observes("currentState") currentStateChanged() { - if (this.get("channel")) { - this.messageBus.unsubscribe(this.get("channel")); + if (this.channel) { + this.messageBus.unsubscribe(this.channel); this.set("channel", null); } this.clear(); - if (!["reply", "edit"].includes(this.get("action"))) { + if (!["reply", "edit"].includes(this.action)) { return; } this.publish({ response_needed: true, - previous: this.get("previousState"), - current: this.get("currentState") + previous: this.previousState, + current: this.currentState }).then(r => { - if (this.get("isDestroyed")) { + if (this.isDestroyed) { return; } this.set("presenceUsers", r.users); @@ -92,7 +92,7 @@ export default Ember.Component.extend({ this.messageBus.subscribe( r.messagebus_channel, message => { - if (!this.get("isDestroyed")) + if (!this.isDestroyed) this.set("presenceUsers", message.users); this._clearTimer = Ember.run.debounce( this, @@ -106,7 +106,7 @@ export default Ember.Component.extend({ }, clear() { - if (!this.get("isDestroyed")) this.set("presenceUsers", []); + if (!this.isDestroyed) this.set("presenceUsers", []); }, publish(data) { diff --git a/plugins/discourse-presence/assets/javascripts/discourse/components/topic-presence-display.js.es6 b/plugins/discourse-presence/assets/javascripts/discourse/components/topic-presence-display.js.es6 index 5ca5d3b6f3f..7cab2563cb8 100644 --- a/plugins/discourse-presence/assets/javascripts/discourse/components/topic-presence-display.js.es6 +++ b/plugins/discourse-presence/assets/javascripts/discourse/components/topic-presence-display.js.es6 @@ -14,7 +14,7 @@ export default Ember.Component.extend({ presenceUsers: null, clear() { - if (!this.get("isDestroyed")) this.set("presenceUsers", []); + if (!this.isDestroyed) this.set("presenceUsers", []); }, @on("didInsertElement") @@ -22,9 +22,9 @@ export default Ember.Component.extend({ this.clear(); this.messageBus.subscribe( - this.get("channel"), + this.channel, message => { - if (!this.get("isDestroyed")) this.set("presenceUsers", message.users); + if (!this.isDestroyed) this.set("presenceUsers", message.users); this._clearTimer = Ember.run.debounce( this, "clear", @@ -38,7 +38,7 @@ export default Ember.Component.extend({ @on("willDestroyElement") _destroyed() { Ember.run.cancel(this._clearTimer); - this.messageBus.unsubscribe(this.get("channel")); + this.messageBus.unsubscribe(this.channel); }, @computed("topicId") diff --git a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 index e49621b884b..0f85aedc2df 100644 --- a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 +++ b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 @@ -89,12 +89,12 @@ export default Ember.Controller.extend({ @observes("isMultiple", "isNumber", "pollOptionsCount") _setPollMax() { - const isMultiple = this.get("isMultiple"); - const isNumber = this.get("isNumber"); + const isMultiple = this.isMultiple; + const isNumber = this.isNumber; if (!isMultiple && !isNumber) return; if (isMultiple) { - this.set("pollMax", this.get("pollOptionsCount")); + this.set("pollMax", this.pollOptionsCount); } else if (isNumber) { this.set("pollMax", this.siteSettings.poll_maximum_options); } @@ -177,7 +177,7 @@ export default Ember.Controller.extend({ let pollHeader = "[poll"; let output = ""; - const match = this.get("toolbarEvent") + const match = this.toolbarEvent .getText() .match(/\[poll(\s+name=[^\s\]]+)*.*\]/gim); @@ -301,7 +301,7 @@ export default Ember.Controller.extend({ actions: { insertPoll() { - this.get("toolbarEvent").addText(this.get("pollOutput")); + this.toolbarEvent.addText(this.pollOutput); this.send("closeModal"); this._setupPoll(); } diff --git a/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6 b/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6 index adb3fb869db..5af0c73cd46 100644 --- a/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6 +++ b/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6 @@ -23,7 +23,7 @@ function initializePollUIBuilder(api) { showPollBuilder() { showModal("poll-ui-builder").set( "toolbarEvent", - this.get("toolbarEvent") + this.toolbarEvent ); } } diff --git a/plugins/poll/assets/javascripts/initializers/extend-for-poll.js.es6 b/plugins/poll/assets/javascripts/initializers/extend-for-poll.js.es6 index 4dbdcfd6b90..46a54fd77ba 100644 --- a/plugins/poll/assets/javascripts/initializers/extend-for-poll.js.es6 +++ b/plugins/poll/assets/javascripts/initializers/extend-for-poll.js.es6 @@ -36,7 +36,7 @@ function initializePolls(api) { // we need a proper ember object so it is bindable @observes("polls") pollsChanged() { - const polls = this.get("polls"); + const polls = this.polls; if (polls) { this._polls = this._polls || {}; polls.forEach(p => { diff --git a/test/javascripts/components/category-chooser-test.js.es6 b/test/javascripts/components/category-chooser-test.js.es6 index ba02fb51a04..91218515792 100644 --- a/test/javascripts/components/category-chooser-test.js.es6 +++ b/test/javascripts/components/category-chooser-test.js.es6 @@ -12,13 +12,13 @@ componentTest("with value", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), 2 ); assert.equal( - this.get("subject") + this.subject .header() .title(), "feature" @@ -30,10 +30,10 @@ componentTest("with excludeCategoryId", { template: "{{category-chooser excludeCategoryId=2}}", async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.notOk( - this.get("subject") + this.subject .rowByValue(2) .exists() ); @@ -44,37 +44,37 @@ componentTest("with scopedCategoryId", { template: "{{category-chooser scopedCategoryId=2}}", async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .title(), "Discussion about features or potential features of Discourse: how they work, why they work, etc." ); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .value(), 2 ); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .title(), "My idea here is to have mini specs for features we would like built but have no bandwidth to build" ); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .value(), 26 ); - assert.equal(this.get("subject").rows().length, 2); + assert.equal(this.subject.rows().length, 2); - await this.get("subject").fillInFilter("dev"); + await this.subject.fillInFilter("dev"); - assert.equal(this.get("subject").rows().length, 3); + assert.equal(this.subject.rows().length, 3); } }); @@ -87,13 +87,13 @@ componentTest("with allowUncategorized=null", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), null ); assert.equal( - this.get("subject") + this.subject .header() .title(), "category" @@ -110,13 +110,13 @@ componentTest("with allowUncategorized=null rootNone=true", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), null ); assert.equal( - this.get("subject") + this.subject .header() .title(), "category" @@ -135,13 +135,13 @@ componentTest("with disallowed uncategorized, rootNone and rootNoneLabel", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), null ); assert.equal( - this.get("subject") + this.subject .header() .title(), "category" @@ -158,13 +158,13 @@ componentTest("with allowed uncategorized", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), null ); assert.equal( - this.get("subject") + this.subject .header() .title(), "uncategorized" @@ -181,13 +181,13 @@ componentTest("with allowed uncategorized and rootNone", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), null ); assert.equal( - this.get("subject") + this.subject .header() .title(), "(no category)" @@ -206,13 +206,13 @@ componentTest("with allowed uncategorized rootNone and rootNoneLabel", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), null ); assert.equal( - this.get("subject") + this.subject .header() .title(), "root none label" diff --git a/test/javascripts/components/category-drop-test.js.es6 b/test/javascripts/components/category-drop-test.js.es6 index 0df5a2d28d7..835063092b4 100644 --- a/test/javascripts/components/category-drop-test.js.es6 +++ b/test/javascripts/components/category-drop-test.js.es6 @@ -25,23 +25,23 @@ componentTest("subcatgories - no selection", { async test(assert) { assert.equal( - this.get("subject") + this.subject .header() .title(), I18n.t("categories.all_subcategories") ); - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .name(), I18n.t("categories.no_subcategory") ); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .name(), this.get("childCategories.firstObject.name") @@ -67,23 +67,23 @@ componentTest("subcatgories - selection", { async test(assert) { assert.equal( - this.get("subject") + this.subject .header() .title(), this.get("childCategories.firstObject.name") ); - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .name(), I18n.t("categories.all_subcategories") ); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .name(), I18n.t("categories.no_subcategory") diff --git a/test/javascripts/components/category-selector-test.js.es6 b/test/javascripts/components/category-selector-test.js.es6 index 07a5a989b77..603af37de39 100644 --- a/test/javascripts/components/category-selector-test.js.es6 +++ b/test/javascripts/components/category-selector-test.js.es6 @@ -17,13 +17,13 @@ componentTest("default", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), 2 ); assert.notOk( - this.get("subject") + this.subject .rowByValue(2) .exists(), "selected categories are not in the list" @@ -40,16 +40,16 @@ componentTest("with blacklist", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.ok( - this.get("subject") + this.subject .rowByValue(6) .exists(), "not blacklisted categories are in the list" ); assert.notOk( - this.get("subject") + this.subject .rowByValue(8) .exists(), "blacklisted categories are not in the list" @@ -66,30 +66,30 @@ componentTest("interactions", { skip: true, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").selectRowByValue(8); + await this.subject.expand(); + await this.subject.selectRowByValue(8); assert.equal( - this.get("subject") + this.subject .header() .value(), "2,6,8", "it adds the selected category" ); - assert.equal(this.get("categories").length, 3); + assert.equal(this.categories.length, 3); - await this.get("subject").expand(); + await this.subject.expand(); - await this.get("subject").keyboard("backspace"); - await this.get("subject").keyboard("backspace"); + await this.subject.keyboard("backspace"); + await this.subject.keyboard("backspace"); assert.equal( - this.get("subject") + this.subject .header() .value(), "2,6", "it removes the last selected category" ); - assert.equal(this.get("categories").length, 2); + assert.equal(this.categories.length, 2); } }); diff --git a/test/javascripts/components/combo-box-test.js.es6 b/test/javascripts/components/combo-box-test.js.es6 index af7ad93f300..589e742f7d8 100644 --- a/test/javascripts/components/combo-box-test.js.es6 +++ b/test/javascripts/components/combo-box-test.js.es6 @@ -13,22 +13,22 @@ componentTest("default", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "hello" ); assert.equal( - this.get("subject") + this.subject .rowByValue(1) .name(), "hello" ); assert.equal( - this.get("subject") + this.subject .rowByValue(2) .name(), "world" @@ -46,16 +46,16 @@ componentTest("with valueAttribute", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByValue(0) .name(), "hello" ); assert.equal( - this.get("subject") + this.subject .rowByValue(1) .name(), "world" @@ -70,16 +70,16 @@ componentTest("with nameProperty", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByValue(0) .name(), "hello" ); assert.equal( - this.get("subject") + this.subject .rowByValue(1) .name(), "world" @@ -94,16 +94,16 @@ componentTest("with an array as content", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByValue("evil") .name(), "evil" ); assert.equal( - this.get("subject") + this.subject .rowByValue("trout") .name(), "trout" @@ -120,37 +120,37 @@ componentTest("with value and none as a string", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .noneRow() .name(), "none" ); assert.equal( - this.get("subject") + this.subject .rowByValue("evil") .name(), "evil" ); assert.equal( - this.get("subject") + this.subject .rowByValue("trout") .name(), "trout" ); assert.equal( - this.get("subject") + this.subject .header() .name(), "trout" ); - assert.equal(this.get("value"), "trout"); + assert.equal(this.value, "trout"); - await this.get("subject").selectNoneRow(); + await this.subject.selectNoneRow(); - assert.equal(this.get("value"), null); + assert.equal(this.value, null); } }); @@ -163,37 +163,37 @@ componentTest("with value and none as an object", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .noneRow() .name(), "none" ); assert.equal( - this.get("subject") + this.subject .rowByValue("evil") .name(), "evil" ); assert.equal( - this.get("subject") + this.subject .rowByValue("trout") .name(), "trout" ); assert.equal( - this.get("subject") + this.subject .header() .name(), "evil" ); - assert.equal(this.get("value"), "evil"); + assert.equal(this.value, "evil"); - await this.get("subject").selectNoneRow(); + await this.subject.selectNoneRow(); - assert.equal(this.get("value"), null); + assert.equal(this.value, null); } }); @@ -207,10 +207,10 @@ componentTest("with no value and none as an object", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "none" @@ -228,10 +228,10 @@ componentTest("with no value and none string", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "none" @@ -247,10 +247,10 @@ componentTest("with no value and no none", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "evil", @@ -267,10 +267,10 @@ componentTest("with empty string as value", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "evil", @@ -289,10 +289,10 @@ componentTest("with noneLabel", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "none", diff --git a/test/javascripts/components/d-editor-test.js.es6 b/test/javascripts/components/d-editor-test.js.es6 index 58ba1f5a4f8..49c3d00ef90 100644 --- a/test/javascripts/components/d-editor-test.js.es6 +++ b/test/javascripts/components/d-editor-test.js.es6 @@ -10,7 +10,7 @@ componentTest("preview updates with markdown", { assert.ok(find(".d-editor-button-bar").length); await fillIn(".d-editor-input", "hello **world**"); - assert.equal(this.get("value"), "hello **world**"); + assert.equal(this.value, "hello **world**"); assert.equal( find(".d-editor-preview") .html() @@ -97,7 +97,7 @@ testCase(`selecting the space before a word`, async function(assert, textarea) { await click(`button.bold`); - assert.equal(this.get("value"), `hello **w**orld.`); + assert.equal(this.value, `hello **w**orld.`); assert.equal(textarea.selectionStart, 8); assert.equal(textarea.selectionEnd, 9); }); @@ -108,7 +108,7 @@ testCase(`selecting the space after a word`, async function(assert, textarea) { await click(`button.bold`); - assert.equal(this.get("value"), `**hello** world.`); + assert.equal(this.value, `**hello** world.`); assert.equal(textarea.selectionStart, 2); assert.equal(textarea.selectionEnd, 7); }); @@ -117,7 +117,7 @@ testCase(`bold button with no selection`, async function(assert, textarea) { await click(`button.bold`); const example = I18n.t(`composer.bold_text`); - assert.equal(this.get("value"), `hello world.**${example}**`); + assert.equal(this.value, `hello world.**${example}**`); assert.equal(textarea.selectionStart, 14); assert.equal(textarea.selectionEnd, 14 + example.length); }); @@ -127,12 +127,12 @@ testCase(`bold button with a selection`, async function(assert, textarea) { textarea.selectionEnd = 11; await click(`button.bold`); - assert.equal(this.get("value"), `hello **world**.`); + assert.equal(this.value, `hello **world**.`); assert.equal(textarea.selectionStart, 8); assert.equal(textarea.selectionEnd, 13); await click(`button.bold`); - assert.equal(this.get("value"), "hello world."); + assert.equal(this.value, "hello world."); assert.equal(textarea.selectionStart, 6); assert.equal(textarea.selectionEnd, 11); }); @@ -144,12 +144,12 @@ testCase(`bold with a multiline selection`, async function(assert, textarea) { textarea.selectionEnd = 12; await click(`button.bold`); - assert.equal(this.get("value"), `**hello**\n\n**world**\n\ntest.`); + assert.equal(this.value, `**hello**\n\n**world**\n\ntest.`); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 20); await click(`button.bold`); - assert.equal(this.get("value"), `hello\n\nworld\n\ntest.`); + assert.equal(this.value, `hello\n\nworld\n\ntest.`); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 12); }); @@ -157,7 +157,7 @@ testCase(`bold with a multiline selection`, async function(assert, textarea) { testCase(`italic button with no selection`, async function(assert, textarea) { await click(`button.italic`); const example = I18n.t(`composer.italic_text`); - assert.equal(this.get("value"), `hello world.*${example}*`); + assert.equal(this.value, `hello world.*${example}*`); assert.equal(textarea.selectionStart, 13); assert.equal(textarea.selectionEnd, 13 + example.length); @@ -168,12 +168,12 @@ testCase(`italic button with a selection`, async function(assert, textarea) { textarea.selectionEnd = 11; await click(`button.italic`); - assert.equal(this.get("value"), `hello *world*.`); + assert.equal(this.value, `hello *world*.`); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 12); await click(`button.italic`); - assert.equal(this.get("value"), "hello world."); + assert.equal(this.value, "hello world."); assert.equal(textarea.selectionStart, 6); assert.equal(textarea.selectionEnd, 11); }); @@ -185,12 +185,12 @@ testCase(`italic with a multiline selection`, async function(assert, textarea) { textarea.selectionEnd = 12; await click(`button.italic`); - assert.equal(this.get("value"), `*hello*\n\n*world*\n\ntest.`); + assert.equal(this.value, `*hello*\n\n*world*\n\ntest.`); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 16); await click(`button.italic`); - assert.equal(this.get("value"), `hello\n\nworld\n\ntest.`); + assert.equal(this.value, `hello\n\nworld\n\ntest.`); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 12); }); @@ -203,7 +203,7 @@ testCase("link modal (cancel)", async function(assert) { await click(".insert-link button.btn-danger"); assert.equal(find(".insert-link.hidden").length, 1); - assert.equal(this.get("value"), "hello world."); + assert.equal(this.value, "hello world."); }); testCase("link modal (simple link)", async function(assert, textarea) { @@ -214,7 +214,7 @@ testCase("link modal (simple link)", async function(assert, textarea) { await fillIn(".insert-link input.link-url", url); await click(".insert-link button.btn-primary"); assert.equal(find(".insert-link.hidden").length, 1); - assert.equal(this.get("value"), `hello world.[${url}](${url})`); + assert.equal(this.value, `hello world.[${url}](${url})`); assert.equal(textarea.selectionStart, 13); assert.equal(textarea.selectionEnd, 13 + url.length); }); @@ -223,7 +223,7 @@ testCase("link modal auto http addition", async function(assert) { await click("button.link"); await fillIn(".insert-link input.link-url", "sam.com"); await click(".insert-link button.btn-primary"); - assert.equal(this.get("value"), `hello world.[sam.com](http://sam.com)`); + assert.equal(this.value, `hello world.[sam.com](http://sam.com)`); }); testCase("link modal (simple link) with selected text", async function( @@ -239,7 +239,7 @@ testCase("link modal (simple link) with selected text", async function( await fillIn(".insert-link input.link-url", "http://eviltrout.com"); await click(".insert-link button.btn-primary"); assert.equal(find(".insert-link.hidden").length, 1); - assert.equal(this.get("value"), "[hello world.](http://eviltrout.com)"); + assert.equal(this.value, "[hello world.](http://eviltrout.com)"); }); testCase("link modal (link with description)", async function(assert) { @@ -249,7 +249,7 @@ testCase("link modal (link with description)", async function(assert) { await click(".insert-link button.btn-primary"); assert.equal(find(".insert-link.hidden").length, 1); assert.equal( - this.get("value"), + this.value, "hello world.[evil trout](http://eviltrout.com)" ); }); @@ -277,7 +277,7 @@ function xyz(x, y, z) { await click("button.code"); assert.equal( - this.get("value"), + this.value, ` function xyz(x, y, z) { if (y === z) { @@ -299,7 +299,7 @@ componentTest("code button", { const textarea = jumpEnd(find("textarea.d-editor-input")[0]); await click("button.code"); - assert.equal(this.get("value"), ` ${I18n.t("composer.code_text")}`); + assert.equal(this.value, ` ${I18n.t("composer.code_text")}`); this.set("value", "first line\n\nsecond line\n\nthird line"); @@ -308,7 +308,7 @@ componentTest("code button", { await click("button.code"); assert.equal( - this.get("value"), + this.value, `first line ${I18n.t("composer.code_text")} second line @@ -320,7 +320,7 @@ third line` await click("button.code"); assert.equal( - this.get("value"), + this.value, `first line second line @@ -334,7 +334,7 @@ third line\`${I18n.t("composer.code_title")}\`` await click("button.code"); assert.equal( - this.get("value"), + this.value, `first\`${I18n.t("composer.code_title")}\` line second line @@ -348,14 +348,14 @@ third line` await click("button.code"); assert.equal( - this.get("value"), + this.value, "first `line`\n\nsecond line\n\nthird line" ); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 11); await click("button.code"); - assert.equal(this.get("value"), "first line\n\nsecond line\n\nthird line"); + assert.equal(this.value, "first line\n\nsecond line\n\nthird line"); assert.equal(textarea.selectionStart, 6); assert.equal(textarea.selectionEnd, 10); @@ -364,14 +364,14 @@ third line` await click("button.code"); assert.equal( - this.get("value"), + this.value, " first line\n\n second line\n\nthird line" ); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 31); await click("button.code"); - assert.equal(this.get("value"), "first line\n\nsecond line\n\nthird line"); + assert.equal(this.value, "first line\n\nsecond line\n\nthird line"); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 23); } @@ -388,7 +388,7 @@ componentTest("code fences", { await click("button.code"); assert.equal( - this.get("value"), + this.value, `\`\`\` ${I18n.t("composer.paste_code_text")} \`\`\`` @@ -405,7 +405,7 @@ ${I18n.t("composer.paste_code_text")} await click("button.code"); assert.equal( - this.get("value"), + this.value, `\`\`\` first line second line @@ -425,7 +425,7 @@ third line await click("button.code"); assert.equal( - this.get("value"), + this.value, `\`${I18n.t("composer.code_title")}\`first line second line third line` @@ -445,7 +445,7 @@ third line` await click("button.code"); assert.equal( - this.get("value"), + this.value, `\`first line\` second line third line` @@ -462,7 +462,7 @@ third line` await click("button.code"); assert.equal( - this.get("value"), + this.value, `\`\`\` first line second line @@ -481,7 +481,7 @@ third line` await click("button.code"); assert.equal( - this.get("value"), + this.value, `first \n\`\`\`\nline\nsecond\n\`\`\`\n line\nthird line` ); @@ -502,12 +502,12 @@ componentTest("quote button - empty lines", { await click("button.quote"); - assert.equal(this.get("value"), "> one\n> \n> two\n> \n> three"); + assert.equal(this.value, "> one\n> \n> two\n> \n> three"); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 25); await click("button.quote"); - assert.equal(this.get("value"), "one\n\ntwo\n\nthree"); + assert.equal(this.value, "one\n\ntwo\n\nthree"); } }); @@ -523,7 +523,7 @@ componentTest("quote button - selecting empty lines", { textarea.selectionEnd = 10; await click("button.quote"); - assert.equal(this.get("value"), "one\n\n\n> \n> two"); + assert.equal(this.value, "one\n\n\n> \n> two"); } }); @@ -532,13 +532,13 @@ testCase("quote button", async function(assert, textarea) { textarea.selectionEnd = 9; await click("button.quote"); - assert.equal(this.get("value"), "hello\n\n> wor\n\nld."); + assert.equal(this.value, "hello\n\n> wor\n\nld."); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 12); await click("button.quote"); - assert.equal(this.get("value"), "hello\n\nwor\n\nld."); + assert.equal(this.value, "hello\n\nwor\n\nld."); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 10); @@ -546,19 +546,19 @@ testCase("quote button", async function(assert, textarea) { textarea.selectionEnd = 15; await click("button.quote"); - assert.equal(this.get("value"), "hello\n\nwor\n\nld.\n\n> Blockquote"); + assert.equal(this.value, "hello\n\nwor\n\nld.\n\n> Blockquote"); }); testCase(`bullet button with no selection`, async function(assert, textarea) { const example = I18n.t("composer.list_item"); await click(`button.bullet`); - assert.equal(this.get("value"), `hello world.\n\n* ${example}`); + assert.equal(this.value, `hello world.\n\n* ${example}`); assert.equal(textarea.selectionStart, 14); assert.equal(textarea.selectionEnd, 16 + example.length); await click(`button.bullet`); - assert.equal(this.get("value"), `hello world.\n\n${example}`); + assert.equal(this.value, `hello world.\n\n${example}`); }); testCase(`bullet button with a selection`, async function(assert, textarea) { @@ -566,12 +566,12 @@ testCase(`bullet button with a selection`, async function(assert, textarea) { textarea.selectionEnd = 11; await click(`button.bullet`); - assert.equal(this.get("value"), `hello\n\n* world\n\n.`); + assert.equal(this.value, `hello\n\n* world\n\n.`); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 14); await click(`button.bullet`); - assert.equal(this.get("value"), `hello\n\nworld\n\n.`); + assert.equal(this.value, `hello\n\nworld\n\n.`); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 12); }); @@ -586,12 +586,12 @@ testCase(`bullet button with a multiple line selection`, async function( textarea.selectionEnd = 20; await click(`button.bullet`); - assert.equal(this.get("value"), "Hello\n\nWorld\n\nEvil"); + assert.equal(this.value, "Hello\n\nWorld\n\nEvil"); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 18); await click(`button.bullet`); - assert.equal(this.get("value"), "* Hello\n\n* World\n\n* Evil"); + assert.equal(this.value, "* Hello\n\n* World\n\n* Evil"); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 24); }); @@ -600,12 +600,12 @@ testCase(`list button with no selection`, async function(assert, textarea) { const example = I18n.t("composer.list_item"); await click(`button.list`); - assert.equal(this.get("value"), `hello world.\n\n1. ${example}`); + assert.equal(this.value, `hello world.\n\n1. ${example}`); assert.equal(textarea.selectionStart, 14); assert.equal(textarea.selectionEnd, 17 + example.length); await click(`button.list`); - assert.equal(this.get("value"), `hello world.\n\n${example}`); + assert.equal(this.value, `hello world.\n\n${example}`); assert.equal(textarea.selectionStart, 14); assert.equal(textarea.selectionEnd, 14 + example.length); }); @@ -615,12 +615,12 @@ testCase(`list button with a selection`, async function(assert, textarea) { textarea.selectionEnd = 11; await click(`button.list`); - assert.equal(this.get("value"), `hello\n\n1. world\n\n.`); + assert.equal(this.value, `hello\n\n1. world\n\n.`); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 15); await click(`button.list`); - assert.equal(this.get("value"), `hello\n\nworld\n\n.`); + assert.equal(this.value, `hello\n\nworld\n\n.`); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 12); }); @@ -632,12 +632,12 @@ testCase(`list button with line sequence`, async function(assert, textarea) { textarea.selectionEnd = 18; await click(`button.list`); - assert.equal(this.get("value"), "1. Hello\n\n2. World\n\n3. Evil"); + assert.equal(this.value, "1. Hello\n\n2. World\n\n3. Evil"); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 27); await click(`button.list`); - assert.equal(this.get("value"), "Hello\n\nWorld\n\nEvil"); + assert.equal(this.value, "Hello\n\nWorld\n\nEvil"); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 18); }); @@ -699,7 +699,7 @@ componentTest("emoji", { await click( '.emoji-picker .section[data-section="smileys_&_emotion"] button.emoji[title="grinning"]' ); - assert.equal(this.get("value"), "hello world.:grinning:"); + assert.equal(this.value, "hello world.:grinning:"); } }); @@ -710,7 +710,7 @@ testCase("replace-text event by default", async function(assert) { .lookup("app-events:main") .trigger("composer:replace-text", "green", "yellow"); - assert.equal(this.get("value"), "red green blue"); + assert.equal(this.value, "red green blue"); }); composerTestCase("replace-text event for composer", async function(assert) { @@ -720,7 +720,7 @@ composerTestCase("replace-text event for composer", async function(assert) { .lookup("app-events:main") .trigger("composer:replace-text", "green", "yellow"); - assert.equal(this.get("value"), "red yellow blue"); + assert.equal(this.value, "red yellow blue"); }); (() => { @@ -823,7 +823,7 @@ composerTestCase("replace-text event for composer", async function(assert) { let expect = await formatTextWithSelection(AFTER, CASE.after); // eslint-disable-line no-undef let actual = await formatTextWithSelection( // eslint-disable-line no-undef - this.get("value"), + this.value, getSelection(textarea) ); assert.equal(actual, expect); diff --git a/test/javascripts/components/mini-tag-chooser-test.js.es6 b/test/javascripts/components/mini-tag-chooser-test.js.es6 index 92f9b84a2fc..765eec965c6 100644 --- a/test/javascripts/components/mini-tag-chooser-test.js.es6 +++ b/test/javascripts/components/mini-tag-chooser-test.js.es6 @@ -40,10 +40,10 @@ componentTest("default", { }, skip: true, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .name(), "bianca", @@ -51,66 +51,66 @@ componentTest("default", { ); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .name(), "régis", "it has the correct tag" ); - await this.get("subject").fillInFilter("régis"); - await this.get("subject").keyboard("enter"); + await this.subject.fillInFilter("régis"); + await this.subject.keyboard("enter"); assert.deepEqual( - this.get("tags"), + this.tags, ["jeff", "neil", "arpit", "régis"], "it selects the tag" ); - await this.get("subject").expand(); - await this.get("subject").fillInFilter("joffrey"); - await this.get("subject").keyboard("enter"); + await this.subject.expand(); + await this.subject.fillInFilter("joffrey"); + await this.subject.keyboard("enter"); assert.deepEqual( - this.get("tags"), + this.tags, ["jeff", "neil", "arpit", "régis", "joffrey"], "it creates the tag" ); - await this.get("subject").expand(); - await this.get("subject").fillInFilter("Joffrey"); - await this.get("subject").keyboard("enter"); - await this.get("subject").collapse(); + await this.subject.expand(); + await this.subject.fillInFilter("Joffrey"); + await this.subject.keyboard("enter"); + await this.subject.collapse(); assert.deepEqual( - this.get("tags"), + this.tags, ["jeff", "neil", "arpit", "régis", "joffrey"], "it does not allow case insensitive duplicate tags" ); - await this.get("subject").expand(); - await this.get("subject").fillInFilter("invalid' Tag"); - await this.get("subject").keyboard("enter"); + await this.subject.expand(); + await this.subject.fillInFilter("invalid' Tag"); + await this.subject.keyboard("enter"); assert.deepEqual( - this.get("tags"), + this.tags, ["jeff", "neil", "arpit", "régis", "joffrey", "invalid-tag"], "it strips invalid characters in tag" ); - await this.get("subject").expand(); - await this.get("subject").fillInFilter("01234567890123456789012345"); - await this.get("subject").keyboard("enter"); + await this.subject.expand(); + await this.subject.fillInFilter("01234567890123456789012345"); + await this.subject.keyboard("enter"); assert.deepEqual( - this.get("tags"), + this.tags, ["jeff", "neil", "arpit", "régis", "joffrey", "invalid-tag"], "it does not allow creating long tags" ); await click( - this.get("subject") + this.subject .el() .find(".selected-tag") .last() ); assert.deepEqual( - this.get("tags"), + this.tags, ["jeff", "neil", "arpit", "régis", "joffrey"], "it removes the tag" ); diff --git a/test/javascripts/components/multi-select-test.js.es6 b/test/javascripts/components/multi-select-test.js.es6 index 9b352cd0e4e..3935e0aa173 100644 --- a/test/javascripts/components/multi-select-test.js.es6 +++ b/test/javascripts/components/multi-select-test.js.es6 @@ -19,7 +19,7 @@ componentTest("with objects and values", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .value(), "1,2" @@ -58,10 +58,10 @@ componentTest("interactions", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .highlightedRow() .name(), "robin", @@ -71,52 +71,52 @@ componentTest("interactions", { await this.set("none", "test.none"); assert.ok( - this.get("subject") + this.subject .noneRow() .exists() ); assert.equal( - this.get("subject") + this.subject .highlightedRow() .name(), "robin", "it highlights the first content row" ); - await this.get("subject").selectRowByValue(3); - await this.get("subject").expand(); + await this.subject.selectRowByValue(3); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .highlightedRow() .name(), "none", "it highlights none row if no content" ); - await this.get("subject").fillInFilter("joffrey"); + await this.subject.fillInFilter("joffrey"); assert.equal( - this.get("subject") + this.subject .highlightedRow() .name(), "joffrey", "it highlights create row when filling filter" ); - await this.get("subject").keyboard("enter"); + await this.subject.keyboard("enter"); assert.equal( - this.get("subject") + this.subject .highlightedRow() .name(), "none", "it highlights none row after creating content and no content left" ); - await this.get("subject").keyboard("backspace"); + await this.subject.keyboard("backspace"); - const $lastSelectedName = this.get("subject") + const $lastSelectedName = this.subject .header() .el() .find(".selected-name") @@ -127,9 +127,9 @@ componentTest("interactions", { "it highlights the last selected name when using backspace" ); - await this.get("subject").keyboard("backspace"); + await this.subject.keyboard("backspace"); - const $lastSelectedName1 = this.get("subject") + const $lastSelectedName1 = this.subject .header() .el() .find(".selected-name") @@ -140,15 +140,15 @@ componentTest("interactions", { "it removes the previous highlighted selected content" ); assert.notOk( - this.get("subject") + this.subject .rowByValue("joffrey") .exists(), "generated content shouldn’t appear in content when removed" ); - await this.get("subject").keyboard("selectAll"); + await this.subject.keyboard("selectAll"); - const $highlightedSelectedNames2 = this.get("subject") + const $highlightedSelectedNames2 = this.subject .header() .el() .find(".selected-name.is-highlighted"); @@ -158,26 +158,26 @@ componentTest("interactions", { "it highlights each selected name" ); - await this.get("subject").keyboard("backspace"); + await this.subject.keyboard("backspace"); - const $selectedNames = this.get("subject") + const $selectedNames = this.subject .header() .el() .find(".selected-name"); assert.equal($selectedNames.length, 0, "it removed all selected content"); - assert.ok(this.get("subject").isFocused()); - assert.ok(this.get("subject").isExpanded()); + assert.ok(this.subject.isFocused()); + assert.ok(this.subject.isExpanded()); - await this.get("subject").keyboard("escape"); + await this.subject.keyboard("escape"); - assert.ok(this.get("subject").isFocused()); - assert.notOk(this.get("subject").isExpanded()); + assert.ok(this.subject.isFocused()); + assert.notOk(this.subject.isExpanded()); - await this.get("subject").keyboard("escape"); + await this.subject.keyboard("escape"); - assert.notOk(this.get("subject").isFocused()); - assert.notOk(this.get("subject").isExpanded()); + assert.notOk(this.subject.isFocused()); + assert.notOk(this.subject.isExpanded()); } }); @@ -189,10 +189,10 @@ componentTest("with limitMatches", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .el() .find(".select-kit-row").length, 2 @@ -208,17 +208,17 @@ componentTest("with minimum", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject").validationMessage(), + this.subject.validationMessage(), "Select at least 1 item." ); - await this.get("subject").selectRowByValue("sam"); + await this.subject.selectRowByValue("sam"); assert.equal( - this.get("subject") + this.subject .header() .label(), "sam" @@ -236,14 +236,14 @@ componentTest("with minimumLabel", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - assert.equal(this.get("subject").validationMessage(), "min 1"); + assert.equal(this.subject.validationMessage(), "min 1"); - await this.get("subject").selectRowByValue("jeff"); + await this.subject.selectRowByValue("jeff"); assert.equal( - this.get("subject") + this.subject .header() .label(), "jeff" @@ -259,9 +259,9 @@ componentTest("with forceEscape", { }, skip: true, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - const row = this.get("subject").rowByIndex(0); + const row = this.subject.rowByIndex(0); assert.equal( row .el() @@ -271,11 +271,11 @@ componentTest("with forceEscape", { "<div>sam</div>" ); - await this.get("subject").fillInFilter("
jeff"); - await this.get("subject").keyboard("enter"); + await this.subject.fillInFilter("jeff"); + await this.subject.keyboard("enter"); assert.equal( - this.get("subject") + this.subject .header() .el() .find(".name") @@ -294,9 +294,9 @@ componentTest("with forceEscape", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - const row = this.get("subject").rowByIndex(0); + const row = this.subject.rowByIndex(0); assert.equal( row .el() @@ -306,11 +306,11 @@ componentTest("with forceEscape", { "sam" ); - await this.get("subject").fillInFilter("jeff"); - await this.get("subject").keyboard("enter"); + await this.subject.fillInFilter("jeff"); + await this.subject.keyboard("enter"); assert.equal( - this.get("subject") + this.subject .header() .el() .find(".name") @@ -339,13 +339,13 @@ componentTest("support modifying on select behavior through plugin api", { }, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").selectRowByValue(1); + await this.subject.expand(); + await this.subject.selectRowByValue(1); assert.equal(find(".on-select-test").html(), "1"); - await this.get("subject").expand(); - await this.get("subject").selectRowByValue(2); + await this.subject.expand(); + await this.subject.selectRowByValue(2); assert.equal( find(".on-select-test").html(), diff --git a/test/javascripts/components/pinned-options-test.js.es6 b/test/javascripts/components/pinned-options-test.js.es6 index 9585fd4dedf..ae6877a6906 100644 --- a/test/javascripts/components/pinned-options-test.js.es6 +++ b/test/javascripts/components/pinned-options-test.js.es6 @@ -28,7 +28,7 @@ componentTest("updating the content refreshes the list", { async test(assert) { assert.equal( - this.get("subject") + this.subject .header() .name(), "pinned" @@ -37,7 +37,7 @@ componentTest("updating the content refreshes the list", { await this.set("pinned", false); assert.equal( - this.get("subject") + this.subject .header() .name(), "unpinned" diff --git a/test/javascripts/components/secret-value-list-test.js.es6 b/test/javascripts/components/secret-value-list-test.js.es6 index a55d2893061..22e4e5d87b9 100644 --- a/test/javascripts/components/secret-value-list-test.js.es6 +++ b/test/javascripts/components/secret-value-list-test.js.es6 @@ -34,7 +34,7 @@ componentTest("adding a value", { ); assert.deepEqual( - this.get("values"), + this.values, "firstKey|FirstValue\nsecondKey|secondValue\nthirdKey|thirdValue", "it adds the value to the list of values" ); @@ -55,7 +55,7 @@ componentTest("adding an invalid value", { ); assert.deepEqual( - this.get("values"), + this.values, undefined, "it doesn't add the value to the list of values" ); @@ -83,7 +83,7 @@ componentTest("removing a value", { ); assert.equal( - this.get("values"), + this.values, "secondKey|secondValue", "it removes the expected value" ); diff --git a/test/javascripts/components/single-select-test.js.es6 b/test/javascripts/components/single-select-test.js.es6 index 8e247978cd5..6c403a0b4c3 100644 --- a/test/javascripts/components/single-select-test.js.es6 +++ b/test/javascripts/components/single-select-test.js.es6 @@ -17,10 +17,10 @@ componentTest("updating the content refreshes the list", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByValue(1) .name(), "BEFORE" @@ -29,7 +29,7 @@ componentTest("updating the content refreshes the list", { await this.set("content", [{ id: 1, name: "AFTER" }]); assert.equal( - this.get("subject") + this.subject .rowByValue(1) .name(), "AFTER" @@ -46,19 +46,19 @@ componentTest("accepts a value by reference", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .selectedRow() .name(), "robin", "it highlights the row corresponding to the value" ); - await this.get("subject").selectRowByValue(1); + await this.subject.selectRowByValue(1); - assert.equal(this.get("value"), 1, "it mutates the value"); + assert.equal(this.value, 1, "it mutates the value"); } }); @@ -67,7 +67,7 @@ componentTest("no default icon", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .icon().length, 0, @@ -80,11 +80,11 @@ componentTest("default search icon", { template: "{{single-select filterable=true}}", async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.ok( exists( - this.get("subject") + this.subject .filter() .icon() ), @@ -97,11 +97,11 @@ componentTest("with no search icon", { template: "{{single-select filterable=true filterIcon=null}}", async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.notOk( exists( - this.get("subject") + this.subject .filter() .icon() ), @@ -114,10 +114,10 @@ componentTest("custom search icon", { template: '{{single-select filterable=true filterIcon="shower"}}', async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.ok( - this.get("subject") + this.subject .filter() .icon() .hasClass("d-icon-shower"), @@ -129,13 +129,13 @@ componentTest("custom search icon", { componentTest("is expandable", { template: "{{single-select}}", async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - assert.ok(this.get("subject").isExpanded()); + assert.ok(this.subject.isExpanded()); - await this.get("subject").collapse(); + await this.subject.collapse(); - assert.notOk(this.get("subject").isExpanded()); + assert.notOk(this.subject.isExpanded()); } }); @@ -149,10 +149,10 @@ componentTest("accepts custom value/name keys", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .selectedRow() .name(), "robin" @@ -170,7 +170,7 @@ componentTest("doesn’t render collection content before first expand", { async test(assert) { assert.notOk(exists(find(".select-kit-collection"))); - await this.get("subject").expand(); + await this.subject.expand(); assert.ok(exists(find(".select-kit-collection"))); } @@ -184,19 +184,19 @@ componentTest("dynamic headerText", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "robin" ); - await this.get("subject").selectRowByValue(2); + await this.subject.selectRowByValue(2); assert.equal( - this.get("subject") + this.subject .header() .name(), "regis", @@ -216,10 +216,10 @@ componentTest("supports custom row template", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByValue(1) .el() .html() @@ -241,10 +241,10 @@ componentTest("supports converting select value to integer", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .selectedRow() .name(), "régis" @@ -253,7 +253,7 @@ componentTest("supports converting select value to integer", { await this.set("value", 1); assert.equal( - this.get("subject") + this.subject .selectedRow() .name(), "robin", @@ -274,10 +274,10 @@ componentTest("supports converting string as boolean to boolean", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .selectedRow() .name(), "ASC" @@ -286,7 +286,7 @@ componentTest("supports converting string as boolean to boolean", { await this.set("value", false); assert.equal( - this.get("subject") + this.subject .selectedRow() .name(), "DESC", @@ -304,65 +304,65 @@ componentTest("supports keyboard events", { skip: true, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").keyboard("down"); + await this.subject.expand(); + await this.subject.keyboard("down"); assert.equal( - this.get("subject") + this.subject .highlightedRow() .title(), "regis", "the next row is highlighted" ); - await this.get("subject").keyboard("down"); + await this.subject.keyboard("down"); assert.equal( - this.get("subject") + this.subject .highlightedRow() .title(), "robin", "it returns to the first row" ); - await this.get("subject").keyboard("up"); + await this.subject.keyboard("up"); assert.equal( - this.get("subject") + this.subject .highlightedRow() .title(), "regis", "it highlights the last row" ); - await this.get("subject").keyboard("enter"); + await this.subject.keyboard("enter"); assert.equal( - this.get("subject") + this.subject .selectedRow() .title(), "regis", "it selects the row when pressing enter" ); assert.notOk( - this.get("subject").isExpanded(), + this.subject.isExpanded(), "it collapses the select box when selecting a row" ); - await this.get("subject").expand(); - await this.get("subject").keyboard("escape"); + await this.subject.expand(); + await this.subject.keyboard("escape"); assert.notOk( - this.get("subject").isExpanded(), + this.subject.isExpanded(), "it collapses the select box" ); - await this.get("subject").expand(); - await this.get("subject").fillInFilter("regis"); - await this.get("subject").keyboard("tab"); + await this.subject.expand(); + await this.subject.fillInFilter("regis"); + await this.subject.keyboard("tab"); assert.notOk( - this.get("subject").isExpanded(), + this.subject.isExpanded(), "it collapses the select box when selecting a row" ); } @@ -382,7 +382,7 @@ componentTest("with allowInitialValueMutation", { test(assert) { assert.equal( - this.get("value"), + this.value, "1", "it mutates the value on initial rendering" ); @@ -402,11 +402,11 @@ componentTest("support appending content through plugin api", { this.set("content", [{ id: "1", name: "robin" }]); }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - assert.equal(this.get("subject").rows().length, 2); + assert.equal(this.subject.rows().length, 2); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .name(), "regis" @@ -436,11 +436,11 @@ componentTest("support modifying content through plugin api", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - assert.equal(this.get("subject").rows().length, 3); + assert.equal(this.subject.rows().length, 3); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .name(), "sam" @@ -464,11 +464,11 @@ componentTest("support prepending content through plugin api", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - assert.equal(this.get("subject").rows().length, 2); + assert.equal(this.subject.rows().length, 2); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .name(), "regis" @@ -496,13 +496,13 @@ componentTest("support modifying on select behavior through plugin api", { }, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").selectRowByValue(1); + await this.subject.expand(); + await this.subject.selectRowByValue(1); assert.equal(find(".on-select-test").html(), "1"); - await this.get("subject").expand(); - await this.get("subject").selectRowByValue(2); + await this.subject.expand(); + await this.subject.selectRowByValue(2); assert.equal( find(".on-select-test").html(), @@ -529,10 +529,10 @@ componentTest("support modifying on select none behavior through plugin api", { }, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").selectRowByValue(1); - await this.get("subject").expand(); - await this.get("subject").selectNoneRow(); + await this.subject.expand(); + await this.subject.selectRowByValue(1); + await this.subject.expand(); + await this.subject.selectNoneRow(); assert.equal(find(".on-select-none-test").html(), "NONE"); @@ -545,14 +545,14 @@ componentTest("with nameChanges", { beforeEach() { this.set("robin", { id: "1", name: "robin" }); - this.set("content", [this.get("robin")]); + this.set("content", [this.robin]); }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "robin" @@ -561,7 +561,7 @@ componentTest("with nameChanges", { await this.set("robin.name", "robin2"); assert.equal( - this.get("subject") + this.subject .header() .name(), "robin2" @@ -577,16 +577,16 @@ componentTest("with null value", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .name(), "robin" ); assert.equal( - this.get("subject") + this.subject .header() .value(), undefined @@ -602,7 +602,7 @@ componentTest("with collection header", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.ok(exists(".collection-header h2")); } @@ -617,7 +617,7 @@ componentTest("with title", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .title(), "My title" @@ -643,7 +643,7 @@ componentTest("support modifying header computed content through plugin api", { test(assert) { assert.equal( - this.get("subject") + this.subject .header() .title(), "Not so evil" @@ -661,10 +661,10 @@ componentTest("with limitMatches", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .el() .find(".select-kit-row").length, 2 @@ -681,17 +681,17 @@ componentTest("with minimum", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject").validationMessage(), + this.subject.validationMessage(), "Select at least 1 item." ); - await this.get("subject").selectRowByValue("sam"); + await this.subject.selectRowByValue("sam"); assert.equal( - this.get("subject") + this.subject .header() .label(), "sam" @@ -709,14 +709,14 @@ componentTest("with minimumLabel", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - assert.equal(this.get("subject").validationMessage(), "min 1"); + assert.equal(this.subject.validationMessage(), "min 1"); - await this.get("subject").selectRowByValue("jeff"); + await this.subject.selectRowByValue("jeff"); assert.equal( - this.get("subject") + this.subject .header() .label(), "jeff" @@ -732,12 +732,12 @@ componentTest("with accents in filter", { }, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").fillInFilter("jéff"); + await this.subject.expand(); + await this.subject.fillInFilter("jéff"); - assert.equal(this.get("subject").rows().length, 1); + assert.equal(this.subject.rows().length, 1); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .name(), "jeff" @@ -753,12 +753,12 @@ componentTest("with accents in content", { }, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").fillInFilter("jeff"); + await this.subject.expand(); + await this.subject.fillInFilter("jeff"); - assert.equal(this.get("subject").rows().length, 1); + assert.equal(this.subject.rows().length, 1); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .name(), "jéff" @@ -772,12 +772,12 @@ componentTest("with no content and allowAny", { skip: true, async test(assert) { await click( - this.get("subject") + this.subject .header() .el() ); - const $filter = this.get("subject") + const $filter = this.subject .filter() .el(); @@ -794,9 +794,9 @@ componentTest("with forceEscape", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - const row = this.get("subject").rowByIndex(0); + const row = this.subject.rowByIndex(0); assert.equal( row .el() @@ -807,7 +807,7 @@ componentTest("with forceEscape", { ); assert.equal( - this.get("subject") + this.subject .header() .el() .find(".selected-name") @@ -826,9 +826,9 @@ componentTest("without forceEscape", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); - const row = this.get("subject").rowByIndex(0); + const row = this.subject.rowByIndex(0); assert.equal( row .el() @@ -839,7 +839,7 @@ componentTest("without forceEscape", { ); assert.equal( - this.get("subject") + this.subject .header() .el() .find(".selected-name") @@ -863,8 +863,8 @@ componentTest("onSelect", { }, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").selectRowByValue("red"); + await this.subject.expand(); + await this.subject.selectRowByValue("red"); assert.equal( find(".test-external-action") @@ -888,10 +888,10 @@ componentTest("onDeselect", { }, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").selectRowByValue("red"); - await this.get("subject").expand(); - await this.get("subject").selectRowByValue("blue"); + await this.subject.expand(); + await this.subject.selectRowByValue("red"); + await this.subject.expand(); + await this.subject.selectRowByValue("blue"); assert.equal( find(".test-external-action") @@ -915,13 +915,13 @@ componentTest("noopRow", { }, async test(assert) { - await this.get("subject").expand(); - await this.get("subject").selectRowByValue("red"); - assert.equal(this.get("value"), "blue", "it doesn’t change the value"); + await this.subject.expand(); + await this.subject.selectRowByValue("red"); + assert.equal(this.value, "blue", "it doesn’t change the value"); - await this.get("subject").expand(); - await this.get("subject").selectRowByValue("green"); - assert.equal(this.get("value"), "green"); + await this.subject.expand(); + await this.subject.selectRowByValue("green"); + assert.equal(this.value, "green"); } }); diff --git a/test/javascripts/components/tag-drop-test.js.es6 b/test/javascripts/components/tag-drop-test.js.es6 index ea8b9d2fc19..e1a5de574d4 100644 --- a/test/javascripts/components/tag-drop-test.js.es6 +++ b/test/javascripts/components/tag-drop-test.js.es6 @@ -38,10 +38,10 @@ componentTest("default", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .name(), "jeff", @@ -49,25 +49,25 @@ componentTest("default", { ); assert.equal( - this.get("subject") + this.subject .rowByIndex(2) .name(), "neil", "it has the correct tag" ); - await this.get("subject").fillInFilter("rég"); + await this.subject.fillInFilter("rég"); assert.equal( - this.get("subject") + this.subject .rowByIndex(0) .name(), "régis", "it displays the searched tag" ); - await this.get("subject").fillInFilter(""); + await this.subject.fillInFilter(""); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .name(), "jeff", @@ -75,8 +75,8 @@ componentTest("default", { ); sandbox.stub(DiscourseURL, "routeTo"); - await this.get("subject").fillInFilter("dav"); - await this.get("subject").keyboard("enter"); + await this.subject.fillInFilter("dav"); + await this.subject.keyboard("enter"); assert.ok( DiscourseURL.routeTo.calledWith("/tags/david"), "it uses lowercase URLs for tags" @@ -93,10 +93,10 @@ componentTest("no tags", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .rowByIndex(1) .name(), undefined, diff --git a/test/javascripts/components/topic-footer-mobile-dropdown-test.js.es6 b/test/javascripts/components/topic-footer-mobile-dropdown-test.js.es6 index 47f0139e9dd..85adcc7186c 100644 --- a/test/javascripts/components/topic-footer-mobile-dropdown-test.js.es6 +++ b/test/javascripts/components/topic-footer-mobile-dropdown-test.js.es6 @@ -22,22 +22,22 @@ componentTest("default", { }, async test(assert) { - await this.get("subject").expand(); + await this.subject.expand(); assert.equal( - this.get("subject") + this.subject .header() .title(), "Topic Controls" ); assert.equal( - this.get("subject") + this.subject .header() .value(), null ); assert.notOk( - this.get("subject") + this.subject .selectedRow() .exists(), "it doesn’t preselect first row" diff --git a/test/javascripts/components/value-list-test.js.es6 b/test/javascripts/components/value-list-test.js.es6 index 02a97830c93..7bbbd21a8e5 100644 --- a/test/javascripts/components/value-list-test.js.es6 +++ b/test/javascripts/components/value-list-test.js.es6 @@ -18,7 +18,7 @@ componentTest("adding a value", { ); assert.deepEqual( - this.get("values"), + this.values, "vinkas\nosama\neviltrout", "it adds the value to the list of values" ); @@ -38,7 +38,7 @@ componentTest("removing a value", { "it removes the value from the list of values" ); - assert.equal(this.get("values"), "osama", "it removes the expected value"); + assert.equal(this.values, "osama", "it removes the expected value"); } }); @@ -58,7 +58,7 @@ componentTest("selecting a value", { ); assert.deepEqual( - this.get("values"), + this.values, "vinkas\nosama\nmaja", "it adds the value to the list of values" ); @@ -81,7 +81,7 @@ componentTest("array support", { ); assert.deepEqual( - this.get("values"), + this.values, ["vinkas", "osama", "eviltrout"], "it adds the value to the list of values" ); @@ -105,7 +105,7 @@ componentTest("delimiter support", { ); assert.deepEqual( - this.get("values"), + this.values, "vinkas|osama|eviltrout", "it adds the value to the list of values" );