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;
|
||||
|
||||
get activeCategories() {
|
||||
return this.site?.categories?.filter((c) =>
|
||||
return this.site.categories?.filter((c) =>
|
||||
c["form_template_ids"].includes(this.args.template.id)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ export default Component.extend({
|
|||
const errors = this.editor.validate();
|
||||
if (!errors.length) {
|
||||
const fieldValue = JSON.stringify(this.editor.getValue());
|
||||
this?.saveChangesCallback(fieldValue);
|
||||
this.saveChangesCallback(fieldValue);
|
||||
} else {
|
||||
this.appEvents.trigger("modal-body:flash", {
|
||||
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"), () => {
|
||||
const textarea = document.querySelector(".d-editor-input");
|
||||
|
|
|
@ -852,7 +852,7 @@ export default Component.extend(
|
|||
this.clearErrors();
|
||||
|
||||
const inModal = this.element.closest("#discourse-modal");
|
||||
if (inModal && this?.site?.mobileView) {
|
||||
if (inModal && this.site.mobileView) {
|
||||
const modalBody = inModal.querySelector(".modal-body");
|
||||
modalBody.style = "";
|
||||
}
|
||||
|
@ -1061,7 +1061,7 @@ export default Component.extend(
|
|||
handleDeprecations() {
|
||||
this._deprecateValueAttribute();
|
||||
this._deprecateMutations();
|
||||
this._handleDeprecatdArgs();
|
||||
this._handleDeprecatedArgs();
|
||||
},
|
||||
|
||||
_computePlacementStrategy() {
|
||||
|
@ -1071,7 +1071,7 @@ export default Component.extend(
|
|||
return placementStrategy;
|
||||
}
|
||||
|
||||
if (this.capabilities?.isIpadOS || this.site?.mobileView) {
|
||||
if (this.capabilities.isIpadOS || this.site.mobileView) {
|
||||
placementStrategy =
|
||||
this.selectKit.options.mobilePlacementStrategy || "absolute";
|
||||
} else {
|
||||
|
@ -1160,7 +1160,7 @@ export default Component.extend(
|
|||
return resolvedDeprecations;
|
||||
},
|
||||
|
||||
_handleDeprecatdArgs() {
|
||||
_handleDeprecatedArgs() {
|
||||
const migrations = {
|
||||
headerIcon: "icon",
|
||||
onExpand: "onOpen",
|
||||
|
|
|
@ -38,7 +38,7 @@ export default Component.extend(UtilsMixin, {
|
|||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (!this?.site?.mobileView) {
|
||||
if (!this.site.mobileView) {
|
||||
this.element.addEventListener("mouseenter", this.handleMouseEnter);
|
||||
this.element.addEventListener("focus", this.handleMouseEnter);
|
||||
this.element.addEventListener("blur", this.handleBlur);
|
||||
|
@ -47,7 +47,8 @@ export default Component.extend(UtilsMixin, {
|
|||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
if (!this?.site?.mobileView && this.element) {
|
||||
|
||||
if (!this.site.mobileView) {
|
||||
this.element.removeEventListener("mouseenter", this.handleBlur);
|
||||
this.element.removeEventListener("focus", this.handleMouseEnter);
|
||||
this.element.removeEventListener("blur", this.handleMouseEnter);
|
||||
|
|
Loading…
Reference in New Issue