A platform for community discussion. Free, open, simple.
DEV: remove .property() deprecations (#7906)
Joffrey JAFFEUX617c74bc79d4
diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6index 205c5fe8539..eb85ef4a414 100644--- a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6+++ b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6@@ -5,11 +5,11 @@ import Report from "admin/models/report";import PeriodComputationMixin from "admin/mixins/period-computation";function staticReport(reportType) {- return function() {+ return Ember.computed("reports.[]", function() {return Ember.makeArray(this.reports).find(report => report.type === reportType);- }.property("reports.[]");+ });}export default Ember.Controller.extend(PeriodComputationMixin, {diff --git a/app/assets/javascripts/discourse/controllers/history.js.es6 b/app/assets/javascripts/discourse/controllers/history.js.es6index df2833e1878..53627c157f6 100644--- a/app/assets/javascripts/discourse/controllers/history.js.es6+++ b/app/assets/javascripts/discourse/controllers/history.js.es6@@ -7,7 +7,7 @@ import { sanitizeAsync } from "discourse/lib/text";import { iconHTML } from "discourse-common/lib/icon-library";function customTagArray(fieldName) {- return function() {+ return Ember.computed(fieldName, function() {var val = this.get(fieldName);if (!val) {return val;@@ -16,7 +16,7 @@ function customTagArray(fieldName) {val = [val];}return val;- }.property(fieldName);+ });}// This controller handles displaying of historydiff --git a/app/assets/javascripts/discourse/lib/computed.js.es6 b/app/assets/javascripts/discourse/lib/computed.js.es6index 2683d944fe6..e6a440eb832 100644--- a/app/assets/javascripts/discourse/lib/computed.js.es6+++ b/app/assets/javascripts/discourse/lib/computed.js.es6@@ -51,10 +51,9 @@ export function propertyLessThan(p1, p2) {**/export function i18n(...args) {const format = args.pop();- const computed = Ember.computed(function() {+ return Ember.computed(...args, function() {return I18n.t(addonFmt(format, ...args.map(a => this.get(a))));});- return computed.property.apply(computed, args);}/**@@ -68,10 +67,9 @@ export function i18n(...args) {**/export function fmt(...args) {const format = args.pop();- const computed = Ember.computed(function() {+ return Ember.computed(...args, function() {return addonFmt(format, ...args.map(a => this.get(a)));});- return computed.property.apply(computed, args);}/**@@ -85,10 +83,9 @@ export function fmt(...args) {**/export function url(...args) {const format = args.pop();- const computed = Ember.computed(function() {+ return Ember.computed(...args, function() {return Discourse.getURL(addonFmt(format, ...args.map(a => this.get(a))));});- return computed.property.apply(computed, args);}/**@@ -102,7 +99,7 @@ export function url(...args) {export function endWith() {const args = Array.prototype.slice.call(arguments, 0);const substring = args.pop();- const computed = Ember.computed(function() {+ return Ember.computed(...args, function() {return args.map(a => this.get(a)).every(s => {@@ -111,7 +108,6 @@ export function endWith() {return lastIndex !== -1 && lastIndex === position;});});- return computed.property.apply(computed, args);}/**diff --git a/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 b/app/assets/javascripts/discourse/mixins/buffered-content.js.es6index aefee9990e5..36f6de60715 100644--- a/app/assets/javascripts/discourse/mixins/buffered-content.js.es6+++ b/app/assets/javascripts/discourse/mixins/buffered-content.js.es6@@ -1,11 +1,11 @@/* global BufferedProxy: true */export function bufferedProperty(property) {const mixin = {- buffered: function() {+ buffered: Ember.computed(property, function() {return Ember.ObjectProxy.extend(BufferedProxy).create({content: this.get(property)});- }.property(property),+ }),rollbackBuffer: function() {this.buffered.discardBufferedChanges();diff --git a/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 b/app/assets/javascripts/discourse/widgets/post-small-action.js.es6index 6e96e56628a..ea45f0ed7c9 100644--- a/app/assets/javascripts/discourse/widgets/post-small-action.js.es6+++ b/app/assets/javascripts/discourse/widgets/post-small-action.js.es6@@ -22,12 +22,12 @@ export function actionDescriptionHtml(actionCode, createdAt, username) {}export function actionDescription(actionCode, createdAt, username) {- return function() {+ return Ember.computed(actionCode, createdAt, function() {const ac = this.get(actionCode);if (ac) {return actionDescriptionHtml(ac, this.get(createdAt), this.get(username));}- }.property(actionCode, createdAt);+ });}const icons = {