DEV: Remove uses of `@on` from native classes (#27327)
Fixes a deprecation warning introduced in a64f021f49
and removes all uses of `@on` in native classes. (those are unnecessary)
This commit is contained in:
parent
bbdf14828b
commit
e57fe1e994
|
@ -2,7 +2,6 @@ import Component from "@ember/component";
|
||||||
import { action, set } from "@ember/object";
|
import { action, set } from "@ember/object";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import { classNameBindings } from "@ember-decorators/component";
|
import { classNameBindings } from "@ember-decorators/component";
|
||||||
import { on } from "@ember-decorators/object";
|
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
@classNameBindings(":value-list", ":secret-value-list")
|
@classNameBindings(":value-list", ":secret-value-list")
|
||||||
|
@ -12,13 +11,12 @@ export default class SecretValueList extends Component {
|
||||||
values = null;
|
values = null;
|
||||||
validationMessage = null;
|
validationMessage = null;
|
||||||
|
|
||||||
@on("didReceiveAttrs")
|
didReceiveAttrs() {
|
||||||
_setupCollection() {
|
super.didReceiveAttrs(...arguments);
|
||||||
const values = this.values;
|
|
||||||
|
|
||||||
this.set(
|
this.set(
|
||||||
"collection",
|
"collection",
|
||||||
this._splitValues(values, this.inputDelimiter || "\n")
|
this._splitValues(this.values, this.inputDelimiter || "\n")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { action } from "@ember/object";
|
||||||
import { empty } from "@ember/object/computed";
|
import { empty } from "@ember/object/computed";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import { classNameBindings } from "@ember-decorators/component";
|
import { classNameBindings } from "@ember-decorators/component";
|
||||||
import { on } from "@ember-decorators/object";
|
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
@classNameBindings(":simple-list", ":value-list")
|
@classNameBindings(":simple-list", ":value-list")
|
||||||
|
@ -18,8 +17,8 @@ export default class SimpleList extends Component {
|
||||||
choices = null;
|
choices = null;
|
||||||
allowAny = false;
|
allowAny = false;
|
||||||
|
|
||||||
@on("didReceiveAttrs")
|
didReceiveAttrs() {
|
||||||
_setupCollection() {
|
super.didReceiveAttrs(...arguments);
|
||||||
this.set("collection", this._splitValues(this.values, this.inputDelimiter));
|
this.set("collection", this._splitValues(this.values, this.inputDelimiter));
|
||||||
this.set("isPredefinedList", !this.allowAny && !isEmpty(this.choices));
|
this.set("isPredefinedList", !this.allowAny && !isEmpty(this.choices));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { classNameBindings, classNames } from "@ember-decorators/component";
|
import { classNameBindings, classNames } from "@ember-decorators/component";
|
||||||
import { on } from "@ember-decorators/object";
|
|
||||||
import highlightHTML from "discourse/lib/highlight-html";
|
import highlightHTML from "discourse/lib/highlight-html";
|
||||||
|
|
||||||
@classNames("site-text")
|
@classNames("site-text")
|
||||||
@classNameBindings("siteText.overridden")
|
@classNameBindings("siteText.overridden")
|
||||||
export default class SiteTextSummary extends Component {
|
export default class SiteTextSummary extends Component {
|
||||||
@on("didInsertElement")
|
didInsertElement() {
|
||||||
highlightTerm() {
|
super.didInsertElement(...arguments);
|
||||||
|
|
||||||
const term = this._searchTerm();
|
const term = this._searchTerm();
|
||||||
|
|
||||||
if (term) {
|
if (term) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ import Component from "@ember/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { empty, reads } from "@ember/object/computed";
|
import { empty, reads } from "@ember/object/computed";
|
||||||
import { classNames } from "@ember-decorators/component";
|
import { classNames } from "@ember-decorators/component";
|
||||||
import { on } from "@ember-decorators/object";
|
|
||||||
import { makeArray } from "discourse-common/lib/helpers";
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
|
@ -18,17 +17,17 @@ export default class ValueList extends Component {
|
||||||
|
|
||||||
@reads("addKey") noneKey;
|
@reads("addKey") noneKey;
|
||||||
|
|
||||||
@on("didReceiveAttrs")
|
didReceiveAttrs() {
|
||||||
_setupCollection() {
|
super.didReceiveAttrs(...arguments);
|
||||||
const values = this.values;
|
|
||||||
if (this.inputType === "array") {
|
if (this.inputType === "array") {
|
||||||
this.set("collection", values || []);
|
this.set("collection", this.values || []);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.set(
|
this.set(
|
||||||
"collection",
|
"collection",
|
||||||
this._splitValues(values, this.inputDelimiter || "\n")
|
this._splitValues(this.values, this.inputDelimiter || "\n")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { warn } from "@ember/debug";
|
import { warn } from "@ember/debug";
|
||||||
import { computed, get } from "@ember/object";
|
import { computed, get } from "@ember/object";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import { on } from "@ember-decorators/object";
|
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { NotificationLevels } from "discourse/lib/notification-levels";
|
import { NotificationLevels } from "discourse/lib/notification-levels";
|
||||||
import PermissionType from "discourse/models/permission-type";
|
import PermissionType from "discourse/models/permission-type";
|
||||||
|
@ -426,21 +425,23 @@ export default class Category extends RestModel {
|
||||||
|
|
||||||
permissions = null;
|
permissions = null;
|
||||||
|
|
||||||
@on("init")
|
init() {
|
||||||
|
super.init(...arguments);
|
||||||
|
this.setupGroupsAndPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
setupGroupsAndPermissions() {
|
setupGroupsAndPermissions() {
|
||||||
const availableGroups = this.available_groups;
|
if (!this.available_groups) {
|
||||||
if (!availableGroups) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.set("availableGroups", availableGroups);
|
|
||||||
|
|
||||||
const groupPermissions = this.group_permissions;
|
this.set("availableGroups", this.available_groups);
|
||||||
|
|
||||||
if (groupPermissions) {
|
if (this.group_permissions) {
|
||||||
this.set(
|
this.set(
|
||||||
"permissions",
|
"permissions",
|
||||||
groupPermissions.map((elem) => {
|
this.group_permissions.map((elem) => {
|
||||||
availableGroups.removeObject(elem.group_name);
|
this.available_groups.removeObject(elem.group_name);
|
||||||
return elem;
|
return elem;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,23 +3,16 @@ import { Promise } from "rsvp";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { url } from "discourse/lib/computed";
|
import { url } from "discourse/lib/computed";
|
||||||
import UserAction from "discourse/models/user-action";
|
import UserAction from "discourse/models/user-action";
|
||||||
import { on } from "discourse-common/utils/decorators";
|
|
||||||
|
|
||||||
export default class UserPostsStream extends EmberObject {
|
export default class UserPostsStream extends EmberObject {
|
||||||
loaded = false;
|
loaded = false;
|
||||||
|
itemsLoaded = 0;
|
||||||
|
canLoadMore = true;
|
||||||
|
content = [];
|
||||||
|
|
||||||
@url("user.username_lower", "filter", "itemsLoaded", "/posts/%@/%@?offset=%@")
|
@url("user.username_lower", "filter", "itemsLoaded", "/posts/%@/%@?offset=%@")
|
||||||
url;
|
url;
|
||||||
|
|
||||||
@on("init")
|
|
||||||
_initialize() {
|
|
||||||
this.setProperties({
|
|
||||||
itemsLoaded: 0,
|
|
||||||
canLoadMore: true,
|
|
||||||
content: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
filterBy(opts) {
|
filterBy(opts) {
|
||||||
if (this.loaded && this.filter === opts.filter) {
|
if (this.loaded && this.filter === opts.filter) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|
Loading…
Reference in New Issue