[FIX] mail: fix traceback in commands with body, commands don't linger

Commands that were expecting a body were not receiving one, and sending
a command would not clear the text input. This commit fixes that.

task-2645395

closes odoo/odoo#76516

X-original-commit: 3274452e41c2c3c097cea3cf24da68fc67b97eb5
Related: odoo/enterprise#20865
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Samuel Degueldre
2021-09-14 17:53:39 +00:00
parent 55692897c5
commit ac4965e104
2 changed files with 7 additions and 4 deletions
@@ -96,14 +96,14 @@ function factory(dependencies) {
* @static
* @param {Object} param0
* @param {mail.thread} param0.channel
* @param {Object} [param0.postData={}]
* @param {Object} [param0.body='']
*/
async execute({ channel, postData = {} }) {
async execute({ channel, body = '' }) {
return this.env.services.rpc({
model: 'mail.channel',
method: this.methodName,
args: [[channel.id]],
kwargs: postData,
kwargs: { body },
});
}
@@ -206,7 +206,10 @@ function factory(dependencies) {
if (this.thread.model === 'mail.channel') {
const command = this._getCommandFromText(this.textInputContent);
if (command) {
command.execute({ channel: this.thread, body: this.textInputContent });
await command.execute({ channel: this.thread, body: this.textInputContent });
if (this.exists()) {
this._reset();
}
return;
}
}