Make unsubsribeLinks observable

This commit is contained in:
djmaze 2021-09-01 16:10:44 +02:00
parent 448120b665
commit fa25be0631
2 changed files with 6 additions and 5 deletions

View file

@ -206,7 +206,7 @@ const SCREENS = {},
}; };
export const export const
popupVisibilityNames = ko.observableArray([]), popupVisibilityNames = ko.observableArray(),
ViewType = { ViewType = {
Popup: 'Popups', Popup: 'Popups',

View file

@ -84,6 +84,7 @@ export class MessageModel extends AbstractModel {
this.attachments = ko.observableArray(new AttachmentCollectionModel); this.attachments = ko.observableArray(new AttachmentCollectionModel);
this.attachmentsSpecData = ko.observableArray(); this.attachmentsSpecData = ko.observableArray();
this.threads = ko.observableArray(); this.threads = ko.observableArray();
this.unsubsribeLinks = ko.observableArray();
this.addComputables({ this.addComputables({
attachmentIconClass: () => FileInfo.getCombinedIconClass(this.hasAttachments() ? this.attachmentsSpecData() : []), attachmentIconClass: () => FileInfo.getCombinedIconClass(this.hasAttachments() ? this.attachmentsSpecData() : []),
@ -105,7 +106,6 @@ export class MessageModel extends AbstractModel {
this.bcc = new EmailCollectionModel; this.bcc = new EmailCollectionModel;
this.replyTo = new EmailCollectionModel; this.replyTo = new EmailCollectionModel;
this.deliveredTo = new EmailCollectionModel; this.deliveredTo = new EmailCollectionModel;
this.unsubsribeLinks = [];
this.body = null; this.body = null;
this.draftInfo = []; this.draftInfo = [];
this.messageId = ''; this.messageId = '';
@ -152,6 +152,7 @@ export class MessageModel extends AbstractModel {
this.readReceipt(''); this.readReceipt('');
this.threads([]); this.threads([]);
this.unsubsribeLinks([]);
this.hasUnseenSubMessage(false); this.hasUnseenSubMessage(false);
this.hasFlaggedSubMessage(false); this.hasFlaggedSubMessage(false);
@ -201,14 +202,14 @@ export class MessageModel extends AbstractModel {
* @returns {boolean} * @returns {boolean}
*/ */
hasUnsubsribeLinks() { hasUnsubsribeLinks() {
return this.unsubsribeLinks && this.unsubsribeLinks.length; return this.unsubsribeLinks().length;
} }
/** /**
* @returns {string} * @returns {string}
*/ */
getFirstUnsubsribeLink() { getFirstUnsubsribeLink() {
return this.unsubsribeLinks && this.unsubsribeLinks.length ? this.unsubsribeLinks[0] || '' : ''; return this.unsubsribeLinks()[0] || '';
} }
/** /**
@ -431,7 +432,7 @@ export class MessageModel extends AbstractModel {
this.bcc = message.bcc; this.bcc = message.bcc;
this.replyTo = message.replyTo; this.replyTo = message.replyTo;
this.deliveredTo = message.deliveredTo; this.deliveredTo = message.deliveredTo;
this.unsubsribeLinks = message.unsubsribeLinks; this.unsubsribeLinks(message.unsubsribeLinks);
this.isUnseen(message.isUnseen()); this.isUnseen(message.isUnseen());
this.isFlagged(message.isFlagged()); this.isFlagged(message.isFlagged());