mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 11:11:59 +08:00
DEV: Move computed to discourseComputed (#8312)
This commit is contained in:

committed by
GitHub

parent
d74546f50e
commit
6275c05c0d
@ -1,10 +1,10 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { extractDomainFromUrl } from "discourse/lib/utilities";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import InputValidation from "discourse/models/input-validation";
|
||||
|
||||
export default Controller.extend({
|
||||
@ -13,12 +13,12 @@ export default Controller.extend({
|
||||
defaultEventTypes: alias("adminWebHooks.defaultEventTypes"),
|
||||
contentTypes: alias("adminWebHooks.contentTypes"),
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
showTagsFilter() {
|
||||
return this.siteSettings.tagging_enabled;
|
||||
},
|
||||
|
||||
@computed("model.isSaving", "saved", "saveButtonDisabled")
|
||||
@discourseComputed("model.isSaving", "saved", "saveButtonDisabled")
|
||||
savingStatus(isSaving, saved, saveButtonDisabled) {
|
||||
if (isSaving) {
|
||||
return I18n.t("saving");
|
||||
@ -30,14 +30,14 @@ export default Controller.extend({
|
||||
return "";
|
||||
},
|
||||
|
||||
@computed("model.isNew")
|
||||
@discourseComputed("model.isNew")
|
||||
saveButtonText(isNew) {
|
||||
return isNew
|
||||
? I18n.t("admin.web_hooks.create")
|
||||
: I18n.t("admin.web_hooks.save");
|
||||
},
|
||||
|
||||
@computed("model.secret")
|
||||
@discourseComputed("model.secret")
|
||||
secretValidation(secret) {
|
||||
if (!isEmpty(secret)) {
|
||||
if (secret.indexOf(" ") !== -1) {
|
||||
@ -56,7 +56,7 @@ export default Controller.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
|
||||
@discourseComputed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
|
||||
eventTypeValidation(isWildcard, eventTypes) {
|
||||
if (!isWildcard && isEmpty(eventTypes)) {
|
||||
return InputValidation.create({
|
||||
@ -66,7 +66,7 @@ export default Controller.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"model.isSaving",
|
||||
"secretValidation",
|
||||
"eventTypeValidation",
|
||||
|
Reference in New Issue
Block a user