Skip to content

EspoCRM – Open Source CRM Application

fix email collapse save

Yurii5bf77746799c
diff --git a/client/src/views/modals/compose-email.js b/client/src/views/modals/compose-email.js
index bb6a4b2198..13623ba851 100644
--- a/client/src/views/modals/compose-email.js
+++ b/client/src/views/modals/compose-email.js
@@ -116,6 +116,10 @@ class ComposeEmailModalView extends EditModalView {
this.events['click a[data-action="fullFormDraft"]'] = () => this.actionFullFormDraft();
+ this.once('remove', () => {
+ this.dialogIsHidden = false;
+ });
+
const helper = new MailtoHelper(this.getConfig(), this.getPreferences(), this.getAcl());
if (helper.toUse()) {
@@ -125,14 +129,10 @@ class ComposeEmailModalView extends EditModalView {
const attributes = this.options.attributes || {};
this.once('after:render', () => document.location.href = helper.composeLink(attributes));
-
- return;
}
+ }
- this.once('remove', () => {
- this.dialogIsHidden = false;
- });
-
+ async setupLate() {
this.listenTo(this.model, 'change', (m, o) => {
if (o.ui) {
this.wasModified = true;
diff --git a/client/src/views/modals/detail.js b/client/src/views/modals/detail.js
index d4a7f6f598..09c937ec83 100644
--- a/client/src/views/modals/detail.js
+++ b/client/src/views/modals/detail.js
@@ -198,7 +198,7 @@ class DetailModalView extends ModalView {
this.sourceModel = this.model;
- this.getModelFactory().create(this.entityType).then(model => {
+ this.getModelFactory().create(this.entityType).then(async model => {
if (!this.sourceModel) {
this.model = model;
this.model.id = this.id;
@@ -216,7 +216,9 @@ class DetailModalView extends ModalView {
this.createRecordView();
});
- this.model.fetch();
+ await this.setupLate();
+
+ await this.model.fetch();
return;
}
@@ -257,6 +259,14 @@ class DetailModalView extends ModalView {
}
}
+ /**
+ * Additional setup with the modal ready.
+ *
+ * @protected
+ * @since 9.3.0
+ */
+ async setupLate() {}
+
/** @private */
setupActionItems() {
const actionItemSetup = new ActionItemSetup();
diff --git a/client/src/views/modals/edit.js b/client/src/views/modals/edit.js
index 3f854c8bea..37e3b32d8f 100644
--- a/client/src/views/modals/edit.js
+++ b/client/src/views/modals/edit.js
@@ -226,22 +226,23 @@ class EditModalView extends ModalView {
model.id = this.id;
}
- model.fetch()
- .then(() => {
- if (!this.headerText) {
- this.headerHtml = this.composeHeaderHtml();
- }
+ await this.setupLate();
- this.createRecordView(model);
- });
+ await model.fetch();
+
+ if (!this.headerText) {
+ this.headerHtml = this.composeHeaderHtml();
+ }
+
+ this.createRecordView(model);
return;
}
- await new DefaultsPopulator().populate(model);
-
this.model = model;
+ await new DefaultsPopulator().populate(model);
+
if (this.options.relate) {
model.setRelate(this.options.relate);
}
@@ -250,6 +251,8 @@ class EditModalView extends ModalView {
model.set(this.options.attributes);
}
+ await this.setupLate();
+
if (!this.headerText) {
this.headerHtml = this.composeHeaderHtml();
}
@@ -264,6 +267,14 @@ class EditModalView extends ModalView {
});
}
+ /**
+ * Additional setup with the modal ready.
+ *
+ * @protected
+ * @since 9.3.0
+ */
+ async setupLate() {}
+
/**
* @param {module:model} model
* @param {function} [callback]