Small fixes

This commit is contained in:
RainLoop Team 2016-07-17 18:03:38 +03:00
parent 278e98561d
commit 786873041f
8 changed files with 561 additions and 507 deletions

View file

@ -247,7 +247,7 @@ class MessageModel extends AbstractModel
this.bcc = emailArrayFromJson(json.Bcc);
this.replyTo = emailArrayFromJson(json.ReplyTo);
this.deliveredTo = emailArrayFromJson(json.DeliveredTo);
this.unsubsribeLinks = json.UnsubsribeLinks;
this.unsubsribeLinks = isNonEmptyArray(json.UnsubsribeLinks) ? json.UnsubsribeLinks : [];
this.subject(json.Subject);
if (isArray(json.SubjectParts))
@ -358,6 +358,20 @@ class MessageModel extends AbstractModel
return result;
}
/**
* @returns {boolean}
*/
hasUnsubsribeLinks() {
return this.unsubsribeLinks && 0 < this.unsubsribeLinks.length;
}
/**
* @returns {string}
*/
getFirstUnsubsribeLink() {
return this.unsubsribeLinks && 0 < this.unsubsribeLinks.length ? (this.unsubsribeLinks[0] || '') : '';
}
/**
* @param {AjaxJsonMessage} json
* @returns {boolean}