diff --git a/dev/Common/Translator.js b/dev/Common/Translator.js index f858338de..cb8570179 100644 --- a/dev/Common/Translator.js +++ b/dev/Common/Translator.js @@ -144,7 +144,7 @@ export const time = Date.parse(element.dateTime) / 1000; } - let key = element.dataset.momentFormat; + let key = element.dataset.timeFormat; if (key) { element.textContent = timestampToString(time, key); if ('FULL' !== key && 'FROMNOW' !== key) { diff --git a/dev/External/User/ko.js b/dev/External/User/ko.js index 306162bc6..7affba8d5 100644 --- a/dev/External/User/ko.js +++ b/dev/External/User/ko.js @@ -103,7 +103,7 @@ Object.assign(ko.bindingHandlers, { } }, - moment: { + time: { init: ttn, update: ttn }, diff --git a/dev/Model/Message.js b/dev/Model/Message.js index 031ab1051..a6868dc3e 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -56,42 +56,51 @@ export class MessageModel extends AbstractModel { constructor() { super(); - this.folder = ''; - this.uid = 0; - this.hash = ''; - this.from = new EmailCollectionModel; - this.to = new EmailCollectionModel; - this.cc = new EmailCollectionModel; - this.bcc = new EmailCollectionModel; - this.sender = new EmailCollectionModel; - this.replyTo = new EmailCollectionModel; - this.deliveredTo = new EmailCollectionModel; - this.body = null; - this.draftInfo = []; - this.dkim = []; - this.spf = []; - this.dmarc = []; - this.messageId = ''; - this.inReplyTo = ''; - this.references = ''; - this.autocrypt = {/*addr:'', 'prefer-encrypt':'nopreference', keydata:'BASE64'*/}; + Object.assign(this, { + folder: '', + uid: 0, + hash: '', + from: new EmailCollectionModel, + to: new EmailCollectionModel, + cc: new EmailCollectionModel, + bcc: new EmailCollectionModel, + sender: new EmailCollectionModel, + replyTo: new EmailCollectionModel, + deliveredTo: new EmailCollectionModel, + body: null, + draftInfo: [], + dkim: [], + spf: [], + dmarc: [], + messageId: '', + inReplyTo: '', + references: '', + autocrypt: {/*addr:'', 'prefer-encrypt':'nopreference', keydata:'BASE64'*/}, + hasVirus: null, // or boolean when scanned + priority: 3, // Normal + internalTimestamp: 0, + senderEmailsString: '', + senderClearEmailsString: '', + isSpam: false, + spamScore: 0, + spamResult: '', + size: 0, + readReceipt: '', + preview: null, + + attachments: ko.observableArray(new AttachmentCollectionModel), + threads: ko.observableArray(), + threadUnseen: ko.observableArray(), + unsubsribeLinks: ko.observableArray(), + flags: ko.observableArray(), + headers: ko.observableArray(new MimeHeaderCollectionModel) + }); addObservablesTo(this, { subject: '', plain: '', html: '', - preview: null, - size: 0, - spamScore: 0, - spamResult: '', - isSpam: false, - hasVirus: null, // or boolean when scanned dateTimestamp: 0, - internalTimestamp: 0, - priority: 3, // Normal - - senderEmailsString: '', - senderClearEmailsString: '', deleted: false, @@ -111,20 +120,11 @@ export class MessageModel extends AbstractModel { pgpEncrypted: null, pgpDecrypted: false, - readReceipt: '', - // rfc8621 id: '', // threadId: '' }); - this.attachments = ko.observableArray(new AttachmentCollectionModel); - this.threads = ko.observableArray(); - this.threadUnseen = ko.observableArray(); - this.unsubsribeLinks = ko.observableArray(); - this.flags = ko.observableArray(); - this.headers = ko.observableArray(new MimeHeaderCollectionModel); - addComputablesTo(this, { attachmentIconClass: () => this.encrypted() ? 'icon-lock' : FileInfo.getAttachmentsIconClass(this.attachments()), @@ -199,23 +199,23 @@ export class MessageModel extends AbstractModel { } spamStatus() { - let spam = this.spamResult(); - return spam ? i18n(this.isSpam() ? 'GLOBAL/SPAM' : 'GLOBAL/NOT_SPAM') + ': ' + spam : ''; + let spam = this.spamResult; + return spam ? i18n(this.isSpam ? 'GLOBAL/SPAM' : 'GLOBAL/NOT_SPAM') + ': ' + spam : ''; } /** * @returns {string} */ friendlySize() { - return FileInfo.friendlySize(this.size()); + return FileInfo.friendlySize(this.size); } computeSenderEmail() { const list = this[ [FolderUserStore.sentFolder(), FolderUserStore.draftsFolder()].includes(this.folder) ? 'to' : 'from' ]; - this.senderEmailsString(list.toString(true)); - this.senderClearEmailsString(list.map(email => email?.email).filter(email => email).join(', ')); + this.senderEmailsString = list.toString(true); + this.senderClearEmailsString = list.map(email => email?.email).filter(email => email).join(', '); } /** @@ -250,9 +250,9 @@ export class MessageModel extends AbstractModel { || headers.valueByName('X-Priority'); if (value) { if (/[h12]/.test(value[0])) { - this.priority(1); + this.priority = 1; } else if (/[l45]/.test(value[0])) { - this.priority(5); + this.priority = 5; } } @@ -264,13 +264,13 @@ export class MessageModel extends AbstractModel { } if (headers.valueByName('X-Virus')) { - this.hasVirus(true); + this.hasVirus = true; } if (value = headers.valueByName('X-Virus-Status')) { if (value.includes('infected')) { - this.hasVirus(true); + this.hasVirus = true; } else if (value.includes('clean')) { - this.hasVirus(false); + this.hasVirus = false; } } /* @@ -301,7 +301,7 @@ export class MessageModel extends AbstractModel { checked: this.checked(), unseen: this.isUnseen(), focused: this.focused(), - priorityHigh: this.priority() === 1, + priorityHigh: this.priority === 1, withAttachments: !!this.attachments().length, // hasChildrenMessage: 1 < this.threadsLen() }, (key, value) => value && classes.push(key)); @@ -368,7 +368,7 @@ export class MessageModel extends AbstractModel { this.hasExternals(result.hasExternals); this.hasImages(!!result.hasExternals); body.innerHTML = result.html; - if (!this.isSpam() && FolderUserStore.spamFolder() != this.folder) { + if (!this.isSpam && FolderUserStore.spamFolder() != this.folder) { if ('always' === SettingsUserStore.viewImages()) { this.showExternalImages(); } diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 2e57a5ae8..336e33f94 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -1194,7 +1194,7 @@ export class ComposePopupView extends AbstractViewPopup { const attachment = new ComposeAttachmentModel( message.requestHash, message.subject() /*+ '-' + Jua.randomId()*/ + '.eml', - message.size() + message.size ); attachment.fromMessage = true; attachment.complete(true); diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index a5e167f60..96fffda4d 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -155,7 +155,7 @@ export class MailMessageView extends AbstractViewRight { : '' ).join(' '), - askReadReceipt: () => currentMessage()?.readReceipt() + askReadReceipt: () => currentMessage()?.readReceipt && !(MessagelistUserStore.isDraftFolder() || MessagelistUserStore.isSentFolder()) && !currentMessage()?.flags().includes('$mdnsent') && !currentMessage()?.flags().includes('\\answered'), @@ -526,7 +526,7 @@ export class MailMessageView extends AbstractViewRight { */ readReceipt() { let oMessage = currentMessage() - if (oMessage.readReceipt()) { + if (oMessage.readReceipt) { Remote.request('SendReadReceiptMessage', iError => { if (!iError) { oMessage.flags.push('$mdnsent'); @@ -535,7 +535,7 @@ export class MailMessageView extends AbstractViewRight { }, { messageFolder: oMessage.folder, messageUid: oMessage.uid, - readReceipt: oMessage.readReceipt(), + readReceipt: oMessage.readReceipt, subject: i18n('READ_RECEIPT/SUBJECT', { SUBJECT: oMessage.subject() }), plain: i18n('READ_RECEIPT/BODY', { 'READ-RECEIPT': AccountUserStore.email() }) }); diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html index d353a3189..3510d9444 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html @@ -144,7 +144,7 @@
- + @@ -164,7 +164,7 @@ - + diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html index 2f234e419..210e0f413 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html @@ -138,7 +138,7 @@