[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
This commit is contained in:
committed by
Lucas Perais
parent
654ee788d9
commit
1db6c8d0ad
@@ -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()
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user