EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Ref
Yurii9d331f919910
diff --git a/client/modules/crm/src/views/record/panels/history.js b/client/modules/crm/src/views/record/panels/history.jsindex 54e748c159..2b2b9e5c59 100644--- a/client/modules/crm/src/views/record/panels/history.js+++ b/client/modules/crm/src/views/record/panels/history.js@@ -176,11 +176,9 @@ class HistoryPanelView extends ActivitiesPanelView {model.fetch().then(() => {- const attributes = emailHelper.getReplyAttributes(- model,- data,- this.getPreferences().get('emailReplyToAllByDefault')- );+ const replyToAllByDefault = this.getPreferences().get('emailReplyToAllByDefault');++ const attributes = emailHelper.getReplyAttributes(model, replyToAllByDefault);const viewName = this.getMetadata().get('clientDefs.Email.modalViews.compose') ||'views/modals/compose-email';diff --git a/client/src/email-helper.js b/client/src/email-helper.jsindex 6387216ca7..419f4ce021 100644--- a/client/src/email-helper.js+++ b/client/src/email-helper.js@@ -76,11 +76,10 @@ class EmailHelper {* Get reply email attributes.** @param {module:model} model An email model.- * @param {Object|null} [data=null] Action data. Unused.* @param {boolean} [cc=false] To include CC (reply-all).* @returns {Object.<string, *>}*/- getReplyAttributes(model, data, cc) {+ getReplyAttributes(model, cc) {const attributes = {status: 'Draft',isHtml: model.attributes.isHtml,diff --git a/client/src/views/email/detail.js b/client/src/views/email/detail.jsindex 67b027f4d0..d79d5e233d 100644--- a/client/src/views/email/detail.js+++ b/client/src/views/email/detail.js@@ -31,6 +31,7 @@ import EmailHelper from 'email-helper';import RecordModal from 'helpers/record-modal';import SelectOneAttachmentModalView from 'views/attachment/modals/select-one';import Utils from 'utils';+import Ui from 'ui';class EmailDetailView extends DetailView {@@ -255,7 +256,9 @@ class EmailDetailView extends DetailView {})this.listenTo(modalView, 'before:save', () => {- this.getRecordView().blockUpdateWebSocket(true);+ if (this.getRecordView().blockUpdateWebSocket) {+ this.getRecordView().blockUpdateWebSocket(true);+ }});}@@ -428,33 +431,42 @@ class EmailDetailView extends DetailView {});}- actionReply(data, e, cc) {+ /**+ * @private+ * @param {boolean} cc+ */+ async actionInternalReply(cc = false) {const emailHelper = new EmailHelper();- const attributes = emailHelper.getReplyAttributes(this.model, data, cc);+ const attributes = emailHelper.getReplyAttributes(this.model, cc);- Espo.Ui.notifyWait();+ Ui.notifyWait();const viewName = this.getMetadata().get('clientDefs.Email.modalViews.compose') ||'views/modals/compose-email';- this.createView('quickCreate', viewName, {+ const view = await this.createView('quickCreate', viewName, {attributes: attributes,focusForCreate: true,- }, view => {- view.render();-- view.notify(false);+ });- this.listenTo(view, 'after:save', () => {- this.model.fetch();- });+ this.listenTo(view, 'after:save', () => {+ this.model.fetch();});++ await view.render();++ Ui.notify();+ }++ // noinspection JSUnusedGlobalSymbols+ actionReply() {+ this.actionInternalReply();}// noinspection JSUnusedGlobalSymbols- actionReplyToAll(data, e) {- this.actionReply(data, e, true);+ actionReplyToAll() {+ this.actionInternalReply(true);}// noinspection JSUnusedGlobalSymbolsdiff --git a/client/src/views/email/modals/detail.js b/client/src/views/email/modals/detail.jsindex ef3f0029c9..24810b5173 100644--- a/client/src/views/email/modals/detail.js+++ b/client/src/views/email/modals/detail.js@@ -28,6 +28,8 @@import DetailModalView from 'views/modals/detail';import DetailView from 'views/email/detail';+import EmailHelper from 'email-helper';+import Ui from 'ui';export default class extends DetailModalView {@@ -64,7 +66,29 @@ export default class extends DetailModalView {}// noinspection JSUnusedGlobalSymbols- actionReply(data, e) {- DetailView.prototype.actionReply.call(this, {}, e, this.getPreferences().get('emailReplyToAllByDefault'));+ async actionReply() {+ const replyByDefault = this.getPreferences().get('emailReplyToAllByDefault');++ const emailHelper = new EmailHelper();++ const attributes = emailHelper.getReplyAttributes(this.model, replyByDefault);++ Ui.notifyWait();++ const viewName = this.getMetadata().get('clientDefs.Email.modalViews.compose') ||+ 'views/modals/compose-email';++ const view = await this.createView('quickCreate', viewName, {+ attributes: attributes,+ focusForCreate: true,+ });++ this.listenTo(view, 'after:save', () => {+ this.model.fetch();+ });++ await view.render();++ Ui.notify();}}