[FIX] mail: re-render thread once on newly added message

When we add a new message, it should re-render the thread only once.

The `addMessage` function must handles new messages and updated messages.
Some code for updated messages should not be executed for new messages,
which is what this commit does.
This commit is contained in:
Alexandre Kühn
2018-07-19 14:01:58 +02:00
parent c040994357
commit f1ae9369ae
@@ -112,14 +112,15 @@ var MailManager = AbstractService.extend({
if (!options.silent) {
this._mailBus.trigger('new_message', message);
}
}
if (data.moderation_status === 'accepted') {
message.setModerationStatus('accepted', {
additionalThreadIDs: data.channel_ids
});
}
if (options.domain && options.domain !== []) {
this._addMessageToThreads(message, options.domain);
} else {
if (data.moderation_status === 'accepted') {
message.setModerationStatus('accepted', {
additionalThreadIDs: data.channel_ids
});
}
if (options.domain && options.domain !== []) {
this._addMessageToThreads(message, options.domain);
}
}
return message;
},