Fix crippled contact names (#1447)

This commit is contained in:
RainLoop 2017-09-27 20:58:15 +03:00
parent ed5685314e
commit d76fde37df
10 changed files with 123 additions and 257 deletions

View file

@ -1517,14 +1517,14 @@ export function resizeAndCrop(url, value, fCallback)
/**
* @param {string} mailToUrl
* @param {Function} PopupComposeVoreModel
* @param {Function} PopupComposeViewModel
* @returns {boolean}
*/
export function mailToHelper(mailToUrl, PopupComposeVoreModel)
export function mailToHelper(mailToUrl, PopupComposeViewModel)
{
if (mailToUrl && 'mailto:' === mailToUrl.toString().substr(0, 7).toLowerCase())
{
if (!PopupComposeVoreModel)
if (!PopupComposeViewModel)
{
return true;
}
@ -1540,28 +1540,22 @@ export function mailToHelper(mailToUrl, PopupComposeVoreModel)
const
email = mailToUrl.replace(/\?.+$/, ''),
query = mailToUrl.replace(/^[^\?]*\?/, ''),
EmailModel = require('Model/Email').default,
emailObj = new EmailModel(),
fParseEmailLine = (line) => (line ? _.compact(_.map(decodeURIComponent(line).split(/[,]/), (item) => {
emailObj.clear();
emailObj.mailsoParse(item);
return '' !== emailObj.email ? emailObj : null;
})) : null);
EmailModel = require('Model/Email').default;
to = fParseEmailLine(email);
to = EmailModel.parseEmailLine(email);
params = simpleQueryParser(query);
if (!isUnd(params.cc))
{
cc = fParseEmailLine(decodeURIComponent(params.cc));
cc = EmailModel.parseEmailLine(decodeURIComponent(params.cc));
}
if (!isUnd(params.bcc))
{
bcc = fParseEmailLine(decodeURIComponent(params.bcc));
bcc = EmailModel.parseEmailLine(decodeURIComponent(params.bcc));
}
require('Knoin/Knoin').showScreenPopup(PopupComposeVoreModel, [
require('Knoin/Knoin').showScreenPopup(PopupComposeViewModel, [
ComposeType.Empty, null, to, cc, bcc,
isUnd(params.subject) ? null : pString(decodeURIComponent(params.subject)),
isUnd(params.body) ? null : plainToHtml(pString(decodeURIComponent(params.body)))