mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 12:17:12 +00: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";
|
import PeriodComputationMixin from "admin/mixins/period-computation";
|
||||||
|
|
||||||
function staticReport(reportType) {
|
function staticReport(reportType) {
|
||||||
return function() {
|
return Ember.computed("reports.[]", function() {
|
||||||
return Ember.makeArray(this.reports).find(
|
return Ember.makeArray(this.reports).find(
|
||||||
report => report.type === reportType
|
report => report.type === reportType
|
||||||
);
|
);
|
||||||
}.property("reports.[]");
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Ember.Controller.extend(PeriodComputationMixin, {
|
export default Ember.Controller.extend(PeriodComputationMixin, {
|
||||||
|
@ -7,7 +7,7 @@ import { sanitizeAsync } from "discourse/lib/text";
|
|||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
|
|
||||||
function customTagArray(fieldName) {
|
function customTagArray(fieldName) {
|
||||||
return function() {
|
return Ember.computed(fieldName, function() {
|
||||||
var val = this.get(fieldName);
|
var val = this.get(fieldName);
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return val;
|
return val;
|
||||||
@ -16,7 +16,7 @@ function customTagArray(fieldName) {
|
|||||||
val = [val];
|
val = [val];
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}.property(fieldName);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// This controller handles displaying of history
|
// This controller handles displaying of history
|
||||||
|
@ -51,10 +51,9 @@ export function propertyLessThan(p1, p2) {
|
|||||||
**/
|
**/
|
||||||
export function i18n(...args) {
|
export function i18n(...args) {
|
||||||
const format = args.pop();
|
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 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) {
|
export function fmt(...args) {
|
||||||
const format = args.pop();
|
const format = args.pop();
|
||||||
const computed = Ember.computed(function() {
|
return Ember.computed(...args, function() {
|
||||||
return addonFmt(format, ...args.map(a => this.get(a)));
|
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) {
|
export function url(...args) {
|
||||||
const format = args.pop();
|
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 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() {
|
export function endWith() {
|
||||||
const args = Array.prototype.slice.call(arguments, 0);
|
const args = Array.prototype.slice.call(arguments, 0);
|
||||||
const substring = args.pop();
|
const substring = args.pop();
|
||||||
const computed = Ember.computed(function() {
|
return Ember.computed(...args, function() {
|
||||||
return args
|
return args
|
||||||
.map(a => this.get(a))
|
.map(a => this.get(a))
|
||||||
.every(s => {
|
.every(s => {
|
||||||
@ -111,7 +108,6 @@ export function endWith() {
|
|||||||
return lastIndex !== -1 && lastIndex === position;
|
return lastIndex !== -1 && lastIndex === position;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return computed.property.apply(computed, args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/* global BufferedProxy: true */
|
/* global BufferedProxy: true */
|
||||||
export function bufferedProperty(property) {
|
export function bufferedProperty(property) {
|
||||||
const mixin = {
|
const mixin = {
|
||||||
buffered: function() {
|
buffered: Ember.computed(property, function() {
|
||||||
return Ember.ObjectProxy.extend(BufferedProxy).create({
|
return Ember.ObjectProxy.extend(BufferedProxy).create({
|
||||||
content: this.get(property)
|
content: this.get(property)
|
||||||
});
|
});
|
||||||
}.property(property),
|
}),
|
||||||
|
|
||||||
rollbackBuffer: function() {
|
rollbackBuffer: function() {
|
||||||
this.buffered.discardBufferedChanges();
|
this.buffered.discardBufferedChanges();
|
||||||
|
@ -22,12 +22,12 @@ export function actionDescriptionHtml(actionCode, createdAt, username) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function actionDescription(actionCode, createdAt, username) {
|
export function actionDescription(actionCode, createdAt, username) {
|
||||||
return function() {
|
return Ember.computed(actionCode, createdAt, function() {
|
||||||
const ac = this.get(actionCode);
|
const ac = this.get(actionCode);
|
||||||
if (ac) {
|
if (ac) {
|
||||||
return actionDescriptionHtml(ac, this.get(createdAt), this.get(username));
|
return actionDescriptionHtml(ac, this.get(createdAt), this.get(username));
|
||||||
}
|
}
|
||||||
}.property(actionCode, createdAt);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user