DEV: remove .property() deprecations (#7906)

DEV: remove .property() deprecations (#7906)

More context at https://deprecations.emberjs.com/v3.x#toc_function-prototype-extensions-property

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 205c5fe..eb85ef4 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.es6
index df2833e..53627c1 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 history
diff --git a/app/assets/javascripts/discourse/lib/computed.js.es6 b/app/assets/javascripts/discourse/lib/computed.js.es6
index 2683d94..e6a440e 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.es6
index aefee99..36f6de6 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.es6
index 6e96e56..ea45f0e 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 = {

GitHub sha: 617c74bc

1 Like