summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components/composer/composer.js
diff options
context:
space:
mode:
authorXavier Dubuc <xdu@odoo.com>2020-08-18 12:24:10 +0000
committerAlexandre Kühn <aku@odoo.com>2020-08-21 12:57:44 +0000
commit0263acee7f355e7367686a461c21f28ea34cfa9a (patch)
tree5f445f8b559c46263d438442b505f629d9545015 /addons/mail/static/src/components/composer/composer.js
parentf25b730b2f548616d62cf8f30907103116e8c0fd (diff)
[FIX] mail: prevent composer to send message if pending uploads
task-2317862 closes odoo/odoo#56303 X-original-commit: 3b5cd048f1dfa18869e95b173b4232b4bb189025 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components/composer/composer.js')
-rw-r--r--addons/mail/static/src/components/composer/composer.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/addons/mail/static/src/components/composer/composer.js b/addons/mail/static/src/components/composer/composer.js
index 5c3968a0fae..afb7d811eae 100644
--- a/addons/mail/static/src/components/composer/composer.js
+++ b/addons/mail/static/src/components/composer/composer.js
@@ -175,9 +175,21 @@ class Composer extends Component {
/**
* Post a message in the composer on related thread.
*
+ * Posting of the message could be aborted if it cannot be posted like if there are attachments
+ * currently uploading or if there is no text content and no attachments.
+ *
* @private
*/
async _postMessage() {
+ if (!this.composer.canPostMessage) {
+ if (this.composer.hasUploadingAttachment) {
+ this.env.services['notification'].notify({
+ message: this.env._t("Please wait while the file is uploading."),
+ type: 'warning',
+ });
+ }
+ return;
+ }
// TODO: take suggested recipients into account (task-2283356)
await this.composer.postMessage();
// TODO: we might need to remove trigger and use the store to wait for the post rpc to be done
@@ -246,9 +258,6 @@ class Composer extends Component {
* @private
*/
_onClickSend() {
- if (!this.composer.canPostMessage) {
- return;
- }
this._postMessage();
}
@@ -335,9 +344,6 @@ class Composer extends Component {
* @private
*/
_onTextInputKeydownEnter() {
- if (!this.composer.canPostMessage) {
- return;
- }
this._postMessage();
}