summaryrefslogtreecommitdiff
path: root/addons/mail
diff options
context:
space:
mode:
authorqdp-odoo <qdp@odoo.com>2016-12-30 17:20:36 +0100
committerqdp-odoo <qdp@odoo.com>2016-12-30 17:21:25 +0100
commit4f29b77e3d1677ffc88336cc99fb7f09d49d7dd1 (patch)
tree0642a57228cc2e0e3ab04d5afbfb5adf882b689c /addons/mail
parent33a413eb2944db4a35d035f42161159ae53dd830 (diff)
[MERGE] foward port of 10.0 up to revision 84a650e33aadb29661121410813e3de37a5ad3e9
Diffstat (limited to 'addons/mail')
-rw-r--r--addons/mail/models/mail_shortcode.py27
-rw-r--r--addons/mail/models/mail_thread.py7
-rw-r--r--addons/mail/static/src/js/chat_manager.js2
-rw-r--r--addons/mail/wizard/mail_compose_message.py13
4 files changed, 15 insertions, 34 deletions
diff --git a/addons/mail/models/mail_shortcode.py b/addons/mail/models/mail_shortcode.py
index 36624bc0b2b..780a5a746c8 100644
--- a/addons/mail/models/mail_shortcode.py
+++ b/addons/mail/models/mail_shortcode.py
@@ -1,10 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-import cgi
-import re
-
-from odoo import api, fields, models
+from odoo import fields, models
class MailShortcode(models.Model):
@@ -23,25 +20,3 @@ class MailShortcode(models.Model):
shortcode_type = fields.Selection([('image', 'Smiley'), ('text', 'Canned Response')], required=True, default='text',
help="* Smiley are only used for HTML code to display an image "\
"* Text (default value) is used to substitute text with another text")
-
- @api.model
- def create(self, values):
- if values.get('substitution'):
- values['substitution'] = self._sanitize_shorcode(values['substitution'])
- return super(MailShortcode, self).create(values)
-
- @api.multi
- def write(self, values):
- if values.get('substitution'):
- values['substitution'] = self._sanitize_shorcode(values['substitution'])
- return super(MailShortcode, self).write(values)
-
- def _sanitize_shorcode(self, substitution):
- """ Sanitize the shortcode substitution :
- - HTML substitution : only allow the img tag (emoji)
- - escape other substitutions to avoid XSS
- """
- is_img_tag = re.match(r'''^<img\s+src=('|")([^'"]*)\1\s*/?>$''', substitution, re.M | re.I)
- if is_img_tag:
- return substitution
- return cgi.escape(substitution)
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index f0e6970bcce..ef27ab2d7c2 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -2049,6 +2049,13 @@ class MailThread(models.AbstractModel):
if self.env.context.get('mail_auto_subscribe_no_notify'):
return
+ # send the email only to the current record and not all the ids matching active_domain !
+ # by default, send_mail for mass_mail use the active_domain instead of active_ids.
+ if 'active_domain' in self.env.context:
+ ctx = dict(self.env.context)
+ ctx.pop('active_domain')
+ self = self.with_context(ctx)
+
for record in self:
record.message_post_with_view(
'mail.message_user_assigned',
diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js
index c002b53e3f1..146196af6c9 100644
--- a/addons/mail/static/src/js/chat_manager.js
+++ b/addons/mail/static/src/js/chat_manager.js
@@ -668,7 +668,7 @@ var chat_manager = {
// to linkify the urls we end up with double linkification a bit everywhere.
// Ideally we want to keep the content as text internally and only make html
// enrichment at display time but the current design makes this quite hard to do.
- var body = utils.linkify(_.str.trim(data.content));
+ var body = utils.parse_and_transform(_.str.trim(data.content), utils.add_link);
var msg = {
partner_ids: data.partner_ids,
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index c58d86668d1..bc27da14e7c 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -12,18 +12,17 @@ from odoo.tools.safe_eval import safe_eval
EXPRESSION_PATTERN = re.compile('(\$\{.+?\})')
-def _reopen(self, res_id, model):
+def _reopen(self, res_id, model, context=None):
+ # save original model in context, because selecting the list of available
+ # templates requires a model in context
+ context = dict(context or {}, default_model=model)
return {'type': 'ir.actions.act_window',
'view_mode': 'form',
'view_type': 'form',
'res_id': res_id,
'res_model': self._name,
'target': 'new',
- # save original model in context, because selecting the list of available
- # templates requires a model in context
- 'context': {
- 'default_model': model,
- },
+ 'context': context,
}
@@ -409,7 +408,7 @@ class MailComposer(models.TransientModel):
# generate the saved template
record.write({'template_id': template.id})
record.onchange_template_id_wrapper()
- return _reopen(self, record.id, record.model)
+ return _reopen(self, record.id, record.model, context=self._context)
#------------------------------------------------------
# Template rendering