Fix incorrect mailto format #1521

This commit is contained in:
RainLoop 2017-10-06 21:52:00 +03:00
parent 71718db8f0
commit 90a3d2b62a
5 changed files with 42 additions and 9 deletions

View file

@ -1542,9 +1542,34 @@ export function mailToHelper(mailToUrl, PopupComposeViewModel)
query = mailToUrl.replace(/^[^\?]*\?/, ''), query = mailToUrl.replace(/^[^\?]*\?/, ''),
EmailModel = require('Model/Email').default; EmailModel = require('Model/Email').default;
to = EmailModel.parseEmailLine(email);
params = simpleQueryParser(query); 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)) if (!isUnd(params.cc))
{ {
cc = EmailModel.parseEmailLine(decodeURIComponent(params.cc)); cc = EmailModel.parseEmailLine(decodeURIComponent(params.cc));

View file

@ -112,8 +112,10 @@ class EmailModel
{ {
if (friendlyView && '' !== this.name) if (friendlyView && '' !== this.name)
{ {
result = wrapWithLink ? '<a href="mailto:' + encodeHtml('"' + this.name + '" <' + this.email + '>') + result = wrapWithLink ? '<a href="mailto:' + encodeHtml(this.email) + '?to=' + encodeHtml('"' + this.name + '" <' + this.email + '>') +
'" target="_blank" tabindex="-1">' + encodeHtml(this.name) + '</a>' : (useEncodeHtml ? encodeHtml(this.name) : this.name); '" target="_blank" tabindex="-1">' + encodeHtml(this.name) + '</a>' : (useEncodeHtml ? encodeHtml(this.name) : this.name);
// result = wrapWithLink ? '<a href="mailto:' + encodeHtml('"' + this.name + '" <' + this.email + '>') +
// '" target="_blank" tabindex="-1">' + encodeHtml(this.name) + '</a>' : (useEncodeHtml ? encodeHtml(this.name) : this.name);
} }
else else
{ {
@ -123,11 +125,17 @@ class EmailModel
if (wrapWithLink) if (wrapWithLink)
{ {
result = encodeHtml('"' + this.name + '" <') + '<a href="mailto:' + result = encodeHtml('"' + this.name + '" <') + '<a href="mailto:' +
encodeHtml('"' + this.name + '" <' + this.email + '>') + encodeHtml(this.email) + '?to=' + encodeHtml('"' + this.name + '" <' + this.email + '>') +
'" target="_blank" tabindex="-1">' + '" target="_blank" tabindex="-1">' +
encodeHtml(result) + encodeHtml(result) +
'</a>' + '</a>' +
encodeHtml('>'); encodeHtml('>');
// result = encodeHtml('"' + this.name + '" <') + '<a href="mailto:' +
// encodeHtml('"' + this.name + '" <' + this.email + '>') +
// '" target="_blank" tabindex="-1">' +
// encodeHtml(result) +
// '</a>' +
// encodeHtml('>');
} }
else else
{ {

View file

@ -1,4 +1,6 @@
import window from 'window';
import $ from '$';
import ko from 'ko'; import ko from 'ko';
import {settingsGet} from 'Storage/Settings'; import {settingsGet} from 'Storage/Settings';
import {AbstractAppStore} from 'Stores/AbstractApp'; import {AbstractAppStore} from 'Stores/AbstractApp';
@ -27,13 +29,9 @@ class AppAdminStore extends AbstractAppStore
this.useLocalProxyForExternalImages(!!settingsGet('UseLocalProxyForExternalImages')); this.useLocalProxyForExternalImages(!!settingsGet('UseLocalProxyForExternalImages'));
if (settingsGet('Auth')) { 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(); export default new AppAdminStore();

View file

@ -640,6 +640,7 @@ gulp.task('watch', ['css:main', 'js:validate'], function() {
}); });
// aliases // aliases
gulp.task('lint', ['js:eslint']);
gulp.task('build', ['rainloop']); gulp.task('build', ['rainloop']);
gulp.task('all', function(callback) { gulp.task('all', function(callback) {

View file

@ -12,7 +12,8 @@
<br /> <br />
<span data-i18n="TAB_GENERAL/ALERT_DATA_ACCESS"></span> <span data-i18n="TAB_GENERAL/ALERT_DATA_ACCESS"></span>
&nbsp; &nbsp;
<strong><a href="https://rainloop.net/docs/installation/#notice">https://rainloop.net/docs/installation</a></strong> <a href="https://www.rainloop.net/docs/installation/#notice"
target="_blank"><strong>https://www.rainloop.net/docs/installation</strong></a>
</div> </div>
</div> </div>
<div class="form-horizontal"> <div class="form-horizontal">