From 1db6c8d0ad9c5b82add3483d30571457773f1ddb Mon Sep 17 00:00:00 2001 From: Tomas Alvarez Date: Wed, 6 Jun 2018 02:57:53 -0500 Subject: [PATCH] [FIX] mail, web_editor: allow tel links in email templates (#24926) Before this commit: links like `tel:+1-555-555-5555` were being replaced both in javascript (prefixing `http`, when using the summernote editor) and python (prefixing the base url, when they were added directly to the template). After this commit: the replacement is avoided on links with `tel` scheme. This is related to commit: 8b97a39 --- addons/mail/models/mail_template.py | 2 +- addons/web_editor/static/src/js/editor/summernote.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py index 65ffe08e1e1..148e6318597 100644 --- a/addons/mail/models/mail_template.py +++ b/addons/mail/models/mail_template.py @@ -300,7 +300,7 @@ class MailTemplate(models.Model): def _process_link(url): new_url = urls.url_parse(url) - if new_url.scheme and (new_url.netloc or new_url.scheme == 'mailto'): + if new_url.scheme and (new_url.netloc or new_url.scheme in ['mailto', 'tel']): return url return new_url.replace(scheme=base.scheme, netloc=base.netloc).to_url() diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js index 256d20f9d5f..e6bca5e1563 100644 --- a/addons/web_editor/static/src/js/editor/summernote.js +++ b/addons/web_editor/static/src/js/editor/summernote.js @@ -2268,7 +2268,7 @@ $.summernote.pluginEvents.backColor = function (event, editor, layoutInfo, backC }; options.onCreateLink = function (sLinkUrl) { - if (sLinkUrl.indexOf('mailto:') === 0) { + if (sLinkUrl.indexOf('mailto:') === 0 || sLinkUrl.indexOf('tel:') === 0) { // pass } else if (sLinkUrl.indexOf('@') !== -1 && sLinkUrl.indexOf(':') === -1) { sLinkUrl = 'mailto:' + sLinkUrl;