summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/services/chat_manager.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-05-29 17:34:43 +0200
committerChristophe Simonis <chs@odoo.com>2018-05-29 17:34:43 +0200
commitf36e6917bd73a56dc0c7468b4849920df4088154 (patch)
treeb63d02ae3e5ffc0815de009407363e0cf906f547 /addons/mail/static/src/js/services/chat_manager.js
parentbc0173c2d58ac26d80cb2f483a95c0c13b047dab (diff)
parent37eed7c509fb5846c89ef37046df4b3cab299719 (diff)
[MERGE] forward port branch saas-11.3 up to 37eed7c509f
Diffstat (limited to 'addons/mail/static/src/js/services/chat_manager.js')
-rw-r--r--addons/mail/static/src/js/services/chat_manager.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/mail/static/src/js/services/chat_manager.js b/addons/mail/static/src/js/services/chat_manager.js
index 6d9a822999d..4bb6e9be6aa 100644
--- a/addons/mail/static/src/js/services/chat_manager.js
+++ b/addons/mail/static/src/js/services/chat_manager.js
@@ -730,7 +730,6 @@ var ChatManager = AbstractService.extend({
args: [options.channelID],
kwargs: _.extend(msg, {
message_type: 'comment',
- content_subtype: 'html',
subtype: 'mail.mt_comment',
command: data.command,
}),
@@ -739,7 +738,6 @@ var ChatManager = AbstractService.extend({
if ('model' in options && 'res_id' in options) {
// post a message in a chatter
_.extend(msg, {
- content_subtype: data.content_subtype,
context: data.context,
message_type: data.message_type,
subtype: data.subtype,
@@ -1357,7 +1355,15 @@ var ChatManager = AbstractService.extend({
//add o_mail_emoji class on each unicode to manage size and font
var unicode = String(value);
var regexp = new RegExp("(?:^|\\s|<[a-z]*>)(" + unicode + ")(?=\\s|$|</[a-z]*>)", "g");
+ var msg_bak = msg.body;
msg.body = msg.body.replace(regexp, ' <span class="o_mail_emoji">'+unicode+'</span> ');
+ // Idiot-proof limit. If the user had the amazing idea of copy-pasting thousands of emojis,
+ // the image rendering can lead to memory overflow errors on some browsers (e.g. Chrome).
+ // Set an arbitrary limit to 200 from which we simply don't replace them (anyway, they are
+ // already replaced by the unicode counterpart).
+ if (_.str.count(msg.body, 'o_mail_emoji') > 200) {
+ msg.body = msg_bak;
+ }
});
function propertyDescr(channel) {
return {