mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Remove unneeded optional chaining operators (#21019)
(and fix a typo, and remove an unnecessary `this.element` check)
This commit is contained in:
parent
79cacba948
commit
584a3a4237
@ -12,7 +12,7 @@ export default class FormTemplateRowItem extends Component {
|
|||||||
@service site;
|
@service site;
|
||||||
|
|
||||||
get activeCategories() {
|
get activeCategories() {
|
||||||
return this.site?.categories?.filter((c) =>
|
return this.site.categories?.filter((c) =>
|
||||||
c["form_template_ids"].includes(this.args.template.id)
|
c["form_template_ids"].includes(this.args.template.id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ export default Component.extend({
|
|||||||
const errors = this.editor.validate();
|
const errors = this.editor.validate();
|
||||||
if (!errors.length) {
|
if (!errors.length) {
|
||||||
const fieldValue = JSON.stringify(this.editor.getValue());
|
const fieldValue = JSON.stringify(this.editor.getValue());
|
||||||
this?.saveChangesCallback(fieldValue);
|
this.saveChangesCallback(fieldValue);
|
||||||
} else {
|
} else {
|
||||||
this.appEvents.trigger("modal-body:flash", {
|
this.appEvents.trigger("modal-body:flash", {
|
||||||
text: errors.mapBy("message").join("\n"),
|
text: errors.mapBy("message").join("\n"),
|
||||||
|
@ -403,7 +403,7 @@ export default Component.extend(KeyEnterEscape, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this?.editPost(postModel);
|
this.editPost(postModel);
|
||||||
|
|
||||||
afterTransition(document.querySelector("#reply-control"), () => {
|
afterTransition(document.querySelector("#reply-control"), () => {
|
||||||
const textarea = document.querySelector(".d-editor-input");
|
const textarea = document.querySelector(".d-editor-input");
|
||||||
|
@ -852,7 +852,7 @@ export default Component.extend(
|
|||||||
this.clearErrors();
|
this.clearErrors();
|
||||||
|
|
||||||
const inModal = this.element.closest("#discourse-modal");
|
const inModal = this.element.closest("#discourse-modal");
|
||||||
if (inModal && this?.site?.mobileView) {
|
if (inModal && this.site.mobileView) {
|
||||||
const modalBody = inModal.querySelector(".modal-body");
|
const modalBody = inModal.querySelector(".modal-body");
|
||||||
modalBody.style = "";
|
modalBody.style = "";
|
||||||
}
|
}
|
||||||
@ -1061,7 +1061,7 @@ export default Component.extend(
|
|||||||
handleDeprecations() {
|
handleDeprecations() {
|
||||||
this._deprecateValueAttribute();
|
this._deprecateValueAttribute();
|
||||||
this._deprecateMutations();
|
this._deprecateMutations();
|
||||||
this._handleDeprecatdArgs();
|
this._handleDeprecatedArgs();
|
||||||
},
|
},
|
||||||
|
|
||||||
_computePlacementStrategy() {
|
_computePlacementStrategy() {
|
||||||
@ -1071,7 +1071,7 @@ export default Component.extend(
|
|||||||
return placementStrategy;
|
return placementStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.capabilities?.isIpadOS || this.site?.mobileView) {
|
if (this.capabilities.isIpadOS || this.site.mobileView) {
|
||||||
placementStrategy =
|
placementStrategy =
|
||||||
this.selectKit.options.mobilePlacementStrategy || "absolute";
|
this.selectKit.options.mobilePlacementStrategy || "absolute";
|
||||||
} else {
|
} else {
|
||||||
@ -1160,7 +1160,7 @@ export default Component.extend(
|
|||||||
return resolvedDeprecations;
|
return resolvedDeprecations;
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleDeprecatdArgs() {
|
_handleDeprecatedArgs() {
|
||||||
const migrations = {
|
const migrations = {
|
||||||
headerIcon: "icon",
|
headerIcon: "icon",
|
||||||
onExpand: "onOpen",
|
onExpand: "onOpen",
|
||||||
|
@ -38,7 +38,7 @@ export default Component.extend(UtilsMixin, {
|
|||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
if (!this?.site?.mobileView) {
|
if (!this.site.mobileView) {
|
||||||
this.element.addEventListener("mouseenter", this.handleMouseEnter);
|
this.element.addEventListener("mouseenter", this.handleMouseEnter);
|
||||||
this.element.addEventListener("focus", this.handleMouseEnter);
|
this.element.addEventListener("focus", this.handleMouseEnter);
|
||||||
this.element.addEventListener("blur", this.handleBlur);
|
this.element.addEventListener("blur", this.handleBlur);
|
||||||
@ -47,7 +47,8 @@ export default Component.extend(UtilsMixin, {
|
|||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
if (!this?.site?.mobileView && this.element) {
|
|
||||||
|
if (!this.site.mobileView) {
|
||||||
this.element.removeEventListener("mouseenter", this.handleBlur);
|
this.element.removeEventListener("mouseenter", this.handleBlur);
|
||||||
this.element.removeEventListener("focus", this.handleMouseEnter);
|
this.element.removeEventListener("focus", this.handleMouseEnter);
|
||||||
this.element.removeEventListener("blur", this.handleMouseEnter);
|
this.element.removeEventListener("blur", this.handleMouseEnter);
|
||||||
|
Loading…
Reference in New Issue
Block a user