[IMP] mail: show message delete confirm dialog when editing it empty

closes odoo/odoo#76594

X-original-commit: db487735f03c9a948d83eedbd2a149241ebd8e1b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Sébastien Theys
2021-09-20 10:53:45 +00:00
parent 95e56d75ad
commit 312fa7faad
2 changed files with 7 additions and 3 deletions
@@ -118,10 +118,10 @@
<p class="o_Message_subject mx-2 mb-1">Subject: <t t-esc="message.subject"/></p>
</t>
<div class="o_Message_content mx-2" t-ref="content">
<t t-if="!message.isEditing or !message.composerInEditing">
<t t-if="message.actionList.showDeleteConfirm or !message.isEditing or !message.composerInEditing">
<div class="o_Message_prettyBody" t-ref="prettyBody"/><!-- message.prettyBody is inserted here from _update() -->
</t>
<t t-if="message.isEditing and message.composerInEditing" >
<t t-if="!message.actionList.showDeleteConfirm and message.isEditing and message.composerInEditing" >
<Composer
class="o_Message_composer mb-1"
composerLocalId="message.composerInEditing.localId"
@@ -331,6 +331,10 @@ function factory(dependencies) {
this.messageInEditing.originThread.unregisterCurrentPartnerIsTyping({ immediateNotify: true });
}
}
if (!this.textInputContent) {
this.messageInEditing.actionList.update({ showDeleteConfirm: true });
return;
}
const escapedAndCompactContent = escapeAndCompactTextContent(this.textInputContent);
let body = escapedAndCompactContent.replace(/&nbsp;/g, ' ').trim();
body = this._generateMentionsLinks(body);
@@ -486,7 +490,7 @@ function factory(dependencies) {
* @returns {boolean}
*/
_computeCanPostMessage() {
if (!this.textInputContent && this.attachments.length === 0) {
if (!this.messageInEditing && !this.textInputContent && this.attachments.length === 0) {
return false;
}
return !this.hasUploadingAttachment && !this.isPostingMessage;