diff --git a/dev/Model/Message.js b/dev/Model/Message.js index 798cfdb94..c7808dfa9 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -25,7 +25,7 @@ import { LanguageStore } from 'Stores/Language'; import Remote from 'Remote/User/Fetch'; const - hcont = Element.fromHTML('
'), + hcont = Element.fromHTML(''), getRealHeight = el => { hcont.innerHTML = el.outerHTML; const result = hcont.clientHeight; @@ -133,22 +133,12 @@ export class MessageModel extends AbstractModel { attachmentIconClass: () => this.encrypted() ? 'icon-lock' : FileInfo.getAttachmentsIconClass(this.attachments()), threadsLen: () => this.threads().length, - listAttachments: () => this.attachments() - .filter(item => SettingsUserStore.listInlineAttachments() || !item.isLinked()), - hasAttachments: () => this.listAttachments().length, isUnseen: () => !this.flags().includes('\\seen'), isFlagged: () => this.flags().includes('\\flagged'), - isReadReceipt: () => this.flags().includes('$mdnsent'), // isJunk: () => this.flags().includes('$junk') && !this.flags().includes('$nonjunk'), // isPhishing: () => this.flags().includes('$phishing'), - tagsToHTML: () => this.flags().map(value => - isAllowedKeyword(value) - ? '' + i18n('MESSAGE_TAGS/'+value,0,value) + '' - : '' - ).join(' '), - tagOptions: () => { const tagOptions = []; FolderUserStore.currentFolder().permanentFlags.forEach(value => { @@ -209,61 +199,6 @@ export class MessageModel extends AbstractModel { } } - /** - * @returns {boolean} - */ - hasUnsubsribeLinks() { - return this.unsubsribeLinks().length; - } - - /** - * @returns {string} - */ - getFirstUnsubsribeLink() { - return this.unsubsribeLinks()[0] || ''; - } - - /** - * @param {boolean} friendlyView - * @param {boolean=} wrapWithLink - * @returns {string} - */ - fromToLine(friendlyView, wrapWithLink) { - return this.from.toString(friendlyView, wrapWithLink); - } - - /** - * @param {boolean} friendlyView - * @param {boolean=} wrapWithLink - * @returns {string} - */ - toToLine(friendlyView, wrapWithLink) { - return this.to.toString(friendlyView, wrapWithLink); - } - - /** - * @param {boolean} friendlyView - * @param {boolean=} wrapWithLink - * @returns {string} - */ - ccToLine(friendlyView, wrapWithLink) { - return this.cc.toString(friendlyView, wrapWithLink); - } - - /** - * @returns {string} - */ - bccToLine() { - return this.bcc.toString(); - } - - /** - * @returns {string} - */ - replyToToLine() { - return this.replyTo.toString(); - } - /** * @return string */ @@ -288,7 +223,7 @@ export class MessageModel extends AbstractModel { /** * @returns {string} */ - viewLink() { + viewRaw() { return serverRequestRaw('ViewAsPlain', this.requestHash); } @@ -390,7 +325,7 @@ export class MessageModel extends AbstractModel { viewPopupMessage(print) { const timeStampInUTC = this.dateTimeStampInUTC() || 0, - ccLine = this.ccToLine(), + ccLine = this.cc.toString(), m = 0 < timeStampInUTC ? new Date(timeStampInUTC * 1000) : null, win = open(''), sdoc = win.document; @@ -402,7 +337,7 @@ export class MessageModel extends AbstractModel { sdoc.write(PreviewHTML .replace('' + i18n('COMPOSE/REPLY_MESSAGE_TITLE', { DATETIME: sDate, EMAIL: sFrom }) + ':
' + sText.trim() @@ -908,9 +908,9 @@ export class ComposePopupView extends AbstractViewPopup { break; case ComposeType.Forward: - sFrom = message.fromToLine(false, true); - sTo = message.toToLine(false, true); - sCc = message.ccToLine(false, true); + sFrom = message.from.toString(false, true); + sTo = message.to.toString(false, true); + sCc = message.cc.toString(false, true); sText = '' + i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') + '
' + i18n('GLOBAL/FROM') + ': ' + sFrom + '
' diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index 47d9511fc..30a5e31b0 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -130,7 +130,7 @@ export class MailMessageView extends AbstractViewRight { this.isDraftFolder = MessagelistUserStore.isDraftFolder; this.isSpamFolder = MessagelistUserStore.isSpamFolder; - this.message = MessageUserStore.message; + this.message = currentMessage; this.messageLoadingThrottle = MessageUserStore.loading; this.messagesBodiesDom = MessageUserStore.bodiesDom; this.messageError = MessageUserStore.error; @@ -157,6 +157,21 @@ export class MailMessageView extends AbstractViewRight { messageVisibility: () => !MessageUserStore.loading() && !!currentMessage(), + tagsToHTML: () => currentMessage()?.flags().map(value => + isAllowedKeyword(value) + ? '' + i18n('MESSAGE_TAGS/'+value,0,value) + '' + : '' + ).join(' '), + + askReadReceipt: () => + (MessagelistUserStore.isDraftFolder() || MessagelistUserStore.isSentFolder()) + && currentMessage()?.readReceipt() + && currentMessage()?.flags().includes('$mdnsent'), + + listAttachments: () => currentMessage()?.attachments() + .filter(item => SettingsUserStore.listInlineAttachments() || !item.isLinked()), + hasAttachments: () => this.listAttachments().length, + canBeRepliedOrForwarded: () => !MessagelistUserStore.isDraftFolder() && this.messageVisibility(), viewFromDkimVisibility: () => 'none' !== this.viewFromDkimData()[0], @@ -181,6 +196,8 @@ export class MailMessageView extends AbstractViewRight { return ''; }, + firstUnsubsribeLink: () => currentMessage()?.unsubsribeLinks()[0] || '', + pgpSupported: () => currentMessage() && PgpUserStore.isSupported(), messageListOrViewLoading: @@ -195,11 +212,11 @@ export class MailMessageView extends AbstractViewRight { } this.viewHash = message.hash; // TODO: make first param a user setting #683 - this.viewFromShort(message.fromToLine(false, true)); + this.viewFromShort(message.from.toString(false, true)); let dkim = 1 === arrayLength(message.from) && message.dkim && message.dkim.find(dkim => message.from[0].email.includes(dkim[1])); this.viewFromDkimData(dkim ? [dkim[0], dkim[2]] : ['none', '']); - this.viewToShort(message.toToLine(true, true)); + this.viewToShort(message.to.toString(true, true)); } else { MessagelistUserStore.selectedMessage(null); @@ -453,13 +470,6 @@ export class MailMessageView extends AbstractViewRight { }); } - /** - * @returns {boolean} - */ - isDraftOrSentFolder() { - return MessagelistUserStore.isDraftFolder() || MessagelistUserStore.isSentFolder(); - } - scrollMessageToTop() { oMessageScrollerDom().scrollTop = (50 < oMessageScrollerDom().scrollTop) ? 50 : 0; } 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 885f5067d..24349cf33 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 @@ -86,8 +86,8 @@- - + +