Permalink
Browse files

[FIX] mail: enable composer after message sent

c5dc0b2 disabled send button on composer sent.

But this is only needed for chatter composer, other composers directly
send the message and are not refreshed asynchronously.

So for other composer, the send button worked one time but then was
disabled and the only way to sent was ENTER (on basic composer) or
CTRL+ENTER (on extended composer).

With this fix, disabling the button is done only for chatter composer.

11.0 backport of 12.0 #28474

issue found when checking opw-1904029
closes #28506
  • Loading branch information...
nle-odoo committed Nov 8, 2018
1 parent e5c8071 commit 05a7e15813d3a65b226422128eeb07345d86df0f
Showing with 15 additions and 3 deletions.
  1. +15 −0 addons/mail/static/src/js/chatter.js
  2. +0 −3 addons/mail/static/src/js/composer.js
@@ -129,6 +129,18 @@ var Chatter = Widget.extend(chat_mixin, {
this.composer.clear_composer();
}
},
/**
* @private
*/
_disableComposer: function () {
this.$(".o_composer_button_send").prop('disabled', true);
},
/**
* @private
*/
_enableComposer: function () {
this.$(".o_composer_button_send").prop('disabled', false);
},
_openComposer: function (options) {
var self = this;
var old_composer = this.composer;
@@ -156,11 +168,14 @@ var Chatter = Widget.extend(chat_mixin, {
self.composer.focus();
}
self.composer.on('post_message', self, function (message) {
self._disableComposer();
self.fields.thread.postMessage(message).then(function () {
self._closeComposer(true);
if (self.postRefresh === 'always' || (self.postRefresh === 'recipients' && message.partner_ids.length)) {
self.trigger_up('reload');
}
}).fail(function () {
self._enableComposer();
});
});
self.composer.on('need_refresh', self, self.trigger_up.bind(self, 'reload'));
@@ -479,13 +479,10 @@ var BasicComposer = Widget.extend(chat_mixin, {
},
send_message: function () {
var $button = this.$('.o_composer_button_send');
if (this.is_empty() || !this.do_check_attachment_upload()) {
return;
}
$button.prop('disabled', true);
clearTimeout(this.canned_timeout);
var self = this;
this.preprocess_message().then(function (message) {

0 comments on commit 05a7e15

Please sign in to comment.