mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 03:12:46 +08:00
DEV: remove .property() deprecations (#7906)
More context at https://deprecations.emberjs.com/v3.x#toc_function-prototype-extensions-property
This commit is contained in:
parent
5e50a24d3a
commit
617c74bc79
|
@ -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, {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user