From 90a3d2b62a626b05b914cdf597fd0b9466803ddc Mon Sep 17 00:00:00 2001 From: RainLoop Date: Fri, 6 Oct 2017 21:52:00 +0300 Subject: [PATCH] Fix incorrect mailto format #1521 --- dev/Common/Utils.js | 27 ++++++++++++++++++- dev/Model/Email.js | 12 +++++++-- dev/Stores/Admin/App.js | 8 +++--- gulpfile.js | 1 + .../Views/Admin/AdminSettingsGeneral.html | 3 ++- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index f2d12c4c0..703894fa1 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -1542,9 +1542,34 @@ export function mailToHelper(mailToUrl, PopupComposeViewModel) query = mailToUrl.replace(/^[^\?]*\?/, ''), EmailModel = require('Model/Email').default; - to = EmailModel.parseEmailLine(email); params = simpleQueryParser(query); + if (!isUnd(params.to)) + { + to = EmailModel.parseEmailLine(decodeURIComponent(email + ',' + params.to)); + to = _.values(to.reduce((result, value) => { + if (value) + { + if (result[value.email]) + { + if (!result[value.email].name) + { + result[value.email] = value; + } + } + else + { + result[value.email] = value; + } + } + return result; + }, {})); + } + else + { + to = EmailModel.parseEmailLine(email); + } + if (!isUnd(params.cc)) { cc = EmailModel.parseEmailLine(decodeURIComponent(params.cc)); diff --git a/dev/Model/Email.js b/dev/Model/Email.js index d6071f02a..1025dc75c 100644 --- a/dev/Model/Email.js +++ b/dev/Model/Email.js @@ -112,8 +112,10 @@ class EmailModel { if (friendlyView && '' !== this.name) { - result = wrapWithLink ? '') + + result = wrapWithLink ? '') + '" target="_blank" tabindex="-1">' + encodeHtml(this.name) + '' : (useEncodeHtml ? encodeHtml(this.name) : this.name); + // result = wrapWithLink ? '') + + // '" target="_blank" tabindex="-1">' + encodeHtml(this.name) + '' : (useEncodeHtml ? encodeHtml(this.name) : this.name); } else { @@ -123,11 +125,17 @@ class EmailModel if (wrapWithLink) { result = encodeHtml('"' + this.name + '" <') + '') + + encodeHtml(this.email) + '?to=' + encodeHtml('"' + this.name + '" <' + this.email + '>') + '" target="_blank" tabindex="-1">' + encodeHtml(result) + '' + encodeHtml('>'); + // result = encodeHtml('"' + this.name + '" <') + '') + + // '" target="_blank" tabindex="-1">' + + // encodeHtml(result) + + // '' + + // encodeHtml('>'); } else { diff --git a/dev/Stores/Admin/App.js b/dev/Stores/Admin/App.js index 8b60055eb..99630604e 100644 --- a/dev/Stores/Admin/App.js +++ b/dev/Stores/Admin/App.js @@ -1,4 +1,6 @@ +import window from 'window'; +import $ from '$'; import ko from 'ko'; import {settingsGet} from 'Storage/Settings'; import {AbstractAppStore} from 'Stores/AbstractApp'; @@ -27,13 +29,9 @@ class AppAdminStore extends AbstractAppStore this.useLocalProxyForExternalImages(!!settingsGet('UseLocalProxyForExternalImages')); if (settingsGet('Auth')) { - this.checkDataFolder(); + $.get('./data/VERSION?' + window.Math.random()).then(() => this.dataFolderAccess(true)); } } - - checkDataFolder() { - $.get('./data/VERSION?' + window.Math.random()).then((value) => this.dataFolderAccess(true)); - } } export default new AppAdminStore(); diff --git a/gulpfile.js b/gulpfile.js index 4df6e8e17..da5f6cf8e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -640,6 +640,7 @@ gulp.task('watch', ['css:main', 'js:validate'], function() { }); // aliases +gulp.task('lint', ['js:eslint']); gulp.task('build', ['rainloop']); gulp.task('all', function(callback) { diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsGeneral.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsGeneral.html index 91d5ca020..2cdbc347b 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsGeneral.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsGeneral.html @@ -12,7 +12,8 @@
  - https://rainloop.net/docs/installation + https://www.rainloop.net/docs/installation