mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-24 23:08:08 +08:00
Resolve #950
This commit is contained in:
parent
98d686bc14
commit
6237a3691b
3 changed files with 5 additions and 5 deletions
|
@ -302,7 +302,7 @@ export class EmailModel extends AbstractModel {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
hash(withoutName = false) {
|
hash(withoutName = false) {
|
||||||
return '#' + (withoutName ? '' : this.name) + '#' + this.email + '#';
|
return '#' + (withoutName ? '' : this.name) + '#' + (this.email || this.name) + '#';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -328,8 +328,8 @@ export class EmailModel extends AbstractModel {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
toLine(friendlyView, wrapWithLink) {
|
toLine(friendlyView, wrapWithLink) {
|
||||||
let result = this.email,
|
let name = this.name,
|
||||||
name = this.name,
|
result = this.email || name,
|
||||||
toLink = text =>
|
toLink = text =>
|
||||||
'<a href="mailto:'
|
'<a href="mailto:'
|
||||||
+ encodeHtml(result) + (name ? '?to=' + encodeURIComponent('"' + name + '" <' + result + '>') : '')
|
+ encodeHtml(result) + (name ? '?to=' + encodeURIComponent('"' + name + '" <' + result + '>') : '')
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Email implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
function __construct(string $sEmail, string $sDisplayName = '')
|
function __construct(string $sEmail, string $sDisplayName = '')
|
||||||
{
|
{
|
||||||
if (!\strlen(\trim($sEmail))) {
|
if (!\strlen(\trim($sEmail)) && !\strlen(\trim($sDisplayName))) {
|
||||||
throw new \InvalidArgumentException;
|
throw new \InvalidArgumentException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class HeaderCollection extends \MailSo\Base\Collection
|
||||||
if (\strlen($sValue)) {
|
if (\strlen($sValue)) {
|
||||||
$oResult = new EmailCollection($sValue);
|
$oResult = new EmailCollection($sValue);
|
||||||
}
|
}
|
||||||
return $oResult && $oResult->count() ? $oResult : null;
|
return $oResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ParametersByName(string $sHeaderName) : ?ParameterCollection
|
public function ParametersByName(string $sHeaderName) : ?ParameterCollection
|
||||||
|
|
Loading…
Reference in a new issue