[FIX] mail : fix post message callback error

When posting a message (here is the livechat use case),
the _postMessage function can call the callback function.
but this parameter is not mandatory.

If the caller of this function doesn't need a callback function
to be called after execution, the _postMessage function was crashing
as callback is not defined.

This commit fix this _postMessage function by checking that
callback is defined before calliing it.

Pre-required for Task ID: 2028059
Fix Task : 2037048
PR #34917

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
David Beguin
2019-07-16 13:49:14 +00:00
parent 3b223c11fd
commit 3a804ecac8
@@ -404,7 +404,7 @@ var AbstractThreadWindow = Widget.extend({
this._thread.postMessage(messageData)
.then(function () {
self._threadWidget.scrollToBottom();
callback();
callback && callback();
});
},
/**