2016-08-17 06:01:20 +08:00
|
|
|
import ko from 'ko';
|
|
|
|
|
2020-09-30 22:10:01 +08:00
|
|
|
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
import {
|
2019-07-05 03:19:24 +08:00
|
|
|
Capa,
|
|
|
|
ComposeType,
|
|
|
|
ClientSideKeyName,
|
|
|
|
KeyState,
|
|
|
|
FolderType,
|
|
|
|
Focused,
|
|
|
|
Layout,
|
|
|
|
MessageSetAction
|
2016-08-17 06:01:20 +08:00
|
|
|
} from 'Common/Enums';
|
|
|
|
|
2020-09-21 23:33:58 +08:00
|
|
|
import { $htmlCL, leftPanelDisabled, keyScopeReal, moveAction } from 'Common/Globals';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-10-15 01:16:37 +08:00
|
|
|
import { inFocus } from 'Common/Utils';
|
2020-10-26 19:54:03 +08:00
|
|
|
import { mailToHelper } from 'Common/UtilsUser';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
import Audio from 'Common/Audio';
|
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
import { i18n } from 'Common/Translator';
|
|
|
|
import { attachmentDownload } from 'Common/Links';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-10-25 20:50:26 +08:00
|
|
|
import { MessageFlagsCache } from 'Common/Cache';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
import AppStore from 'Stores/User/App';
|
|
|
|
import SettingsStore from 'Stores/User/Settings';
|
|
|
|
import AccountStore from 'Stores/User/Account';
|
|
|
|
import FolderStore from 'Stores/User/Folder';
|
|
|
|
import MessageStore from 'Stores/User/Message';
|
|
|
|
|
|
|
|
import * as Local from 'Storage/Client';
|
|
|
|
|
2020-09-15 01:40:56 +08:00
|
|
|
import Remote from 'Remote/User/Fetch';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
import { view, command, ViewType, showScreenPopup, createCommand } from 'Knoin/Knoin';
|
|
|
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-09-04 18:05:17 +08:00
|
|
|
const Settings = rl.settings;
|
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
function isTransparent(color) {
|
|
|
|
return 'rgba(0, 0, 0, 0)' === color || 'transparent' === color;
|
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
@view({
|
|
|
|
name: 'View/User/MailBox/MessageView',
|
|
|
|
type: ViewType.Right,
|
|
|
|
templateID: 'MailMessageView'
|
|
|
|
})
|
2019-07-05 03:19:24 +08:00
|
|
|
class MessageViewMailBoxUserView extends AbstractViewNext {
|
2016-08-17 06:01:20 +08:00
|
|
|
constructor() {
|
|
|
|
super();
|
2014-08-20 23:03:12 +08:00
|
|
|
|
2020-09-22 16:54:00 +08:00
|
|
|
const createCommandReplyHelper = type =>
|
2019-07-05 03:19:24 +08:00
|
|
|
createCommand(() => {
|
|
|
|
this.lastReplyAction(type);
|
|
|
|
this.replyOrforward(type);
|
2020-09-22 16:54:00 +08:00
|
|
|
}, this.canBeRepliedOrForwarded),
|
2019-07-05 03:19:24 +08:00
|
|
|
|
2020-09-22 16:54:00 +08:00
|
|
|
createCommandActionHelper = (folderType, useFolder) =>
|
2019-07-05 03:19:24 +08:00
|
|
|
createCommand(() => {
|
|
|
|
const message = this.message();
|
|
|
|
if (message && this.allowMessageListActions) {
|
|
|
|
this.message(null);
|
2020-10-23 21:15:54 +08:00
|
|
|
rl.app.deleteMessagesFromFolder(folderType, message.folder, [message.uid], useFolder);
|
2019-07-05 03:19:24 +08:00
|
|
|
}
|
|
|
|
}, this.messageVisibility);
|
2014-08-20 23:03:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.oHeaderDom = null;
|
|
|
|
this.oMessageScrollerDom = null;
|
2014-08-20 23:03:12 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
this.addObservables({
|
|
|
|
bodyBackgroundColor: '',
|
|
|
|
showAttachmnetControls: false,
|
|
|
|
downloadAsZipLoading: false,
|
|
|
|
lastReplyAction_: '',
|
|
|
|
showFullInfo: '1' === Local.get(ClientSideKeyName.MessageHeaderFullInfo),
|
|
|
|
moreDropdownTrigger: false
|
|
|
|
});
|
2014-08-20 23:03:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.pswp = null;
|
2015-06-01 01:40:54 +08:00
|
|
|
|
2017-03-02 02:38:18 +08:00
|
|
|
this.moveAction = moveAction;
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.allowComposer = !!Settings.capa(Capa.Composer);
|
|
|
|
this.allowMessageActions = !!Settings.capa(Capa.MessageActions);
|
|
|
|
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
|
2014-12-06 05:01:33 +08:00
|
|
|
|
2020-09-04 18:05:17 +08:00
|
|
|
this.logoImg = (Settings.get('UserLogoMessage')||'').trim();
|
|
|
|
this.logoIframe = (Settings.get('UserIframeMessage')||'').trim();
|
2015-05-20 06:05:54 +08:00
|
|
|
|
2020-09-04 18:05:17 +08:00
|
|
|
this.mobile = !!Settings.app('mobile');
|
2015-05-20 06:05:54 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.attachmentsActions = AppStore.attachmentsActions;
|
2016-05-01 09:07:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.message = MessageStore.message;
|
2020-09-20 17:29:31 +08:00
|
|
|
// this.messageListChecked = MessageStore.messageListChecked;
|
2016-08-17 06:01:20 +08:00
|
|
|
this.hasCheckedMessages = MessageStore.hasCheckedMessages;
|
|
|
|
this.messageListCheckedOrSelectedUidsWithSubMails = MessageStore.messageListCheckedOrSelectedUidsWithSubMails;
|
|
|
|
this.messageLoadingThrottle = MessageStore.messageLoadingThrottle;
|
|
|
|
this.messagesBodiesDom = MessageStore.messagesBodiesDom;
|
|
|
|
this.useThreads = SettingsStore.useThreads;
|
|
|
|
this.replySameFolder = SettingsStore.replySameFolder;
|
|
|
|
this.layout = SettingsStore.layout;
|
|
|
|
this.usePreviewPane = SettingsStore.usePreviewPane;
|
|
|
|
this.isMessageSelected = MessageStore.isMessageSelected;
|
|
|
|
this.messageActiveDom = MessageStore.messageActiveDom;
|
|
|
|
this.messageError = MessageStore.messageError;
|
2015-04-25 06:15:11 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.fullScreenMode = MessageStore.messageFullScreenMode;
|
2014-08-22 23:08:56 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
this.messageListOfThreadsLoading = ko.observable(false).extend({ rateLimit: 1 });
|
|
|
|
this.highlightUnselectedAttachments = ko.observable(false).extend({ falseTimeout: 2000 });
|
2014-08-20 23:03:12 +08:00
|
|
|
|
2020-10-02 18:40:33 +08:00
|
|
|
this.showAttachmnetControlsState = v => Local.set(ClientSideKeyName.MessageAttachmentControls, !!v);
|
2017-09-22 04:28:14 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
this.downloadAsZipError = ko.observable(false).extend({ falseTimeout: 7000 });
|
2015-04-25 06:15:11 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
this.messageDomFocused = ko.observable(false).extend({ rateLimit: 0 });
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
// commands
|
2016-09-03 07:19:37 +08:00
|
|
|
this.replyCommand = createCommandReplyHelper(ComposeType.Reply);
|
|
|
|
this.replyAllCommand = createCommandReplyHelper(ComposeType.ReplyAll);
|
|
|
|
this.forwardCommand = createCommandReplyHelper(ComposeType.Forward);
|
|
|
|
this.forwardAsAttachmentCommand = createCommandReplyHelper(ComposeType.ForwardAsAttachment);
|
|
|
|
this.editAsNewCommand = createCommandReplyHelper(ComposeType.EditAsNew);
|
|
|
|
|
|
|
|
this.deleteCommand = createCommandActionHelper(FolderType.Trash, true);
|
|
|
|
this.deleteWithoutMoveCommand = createCommandActionHelper(FolderType.Trash, false);
|
|
|
|
this.archiveCommand = createCommandActionHelper(FolderType.Archive, true);
|
|
|
|
this.spamCommand = createCommandActionHelper(FolderType.Spam, true);
|
|
|
|
this.notSpamCommand = createCommandActionHelper(FolderType.NotSpam, true);
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
// viewer
|
|
|
|
|
|
|
|
this.viewFolder = '';
|
|
|
|
this.viewUid = '';
|
|
|
|
this.viewHash = '';
|
2020-10-26 19:54:03 +08:00
|
|
|
this.addObservables({
|
|
|
|
viewBodyTopValue: 0,
|
|
|
|
viewSubject: '',
|
|
|
|
viewFromShort: '',
|
|
|
|
viewFromDkimData: ['none', ''],
|
|
|
|
viewToShort: '',
|
|
|
|
viewFrom: '',
|
|
|
|
viewTo: '',
|
|
|
|
viewCc: '',
|
|
|
|
viewBcc: '',
|
|
|
|
viewReplyTo: '',
|
|
|
|
viewTimeStamp: 0,
|
|
|
|
viewSize: '',
|
|
|
|
viewLineAsCss: '',
|
|
|
|
viewViewLink: '',
|
|
|
|
viewUnsubscribeLink: '',
|
|
|
|
viewDownloadLink: '',
|
|
|
|
viewIsImportant: false,
|
|
|
|
viewIsFlagged: false
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
2014-08-20 23:03:12 +08:00
|
|
|
|
2020-10-26 21:44:34 +08:00
|
|
|
this.addComputables({
|
|
|
|
allowAttachmnetControls: () => this.attachmentsActions().length && Settings.capa(Capa.AttachmentsActions),
|
|
|
|
|
|
|
|
downloadAsZipAllowed: () => this.attachmentsActions().includes('zip') && this.allowAttachmnetControls(),
|
|
|
|
|
|
|
|
lastReplyAction: {
|
|
|
|
read: this.lastReplyAction_,
|
|
|
|
write: value => this.lastReplyAction_(
|
|
|
|
[ComposeType.Reply, ComposeType.ReplyAll, ComposeType.Forward].includes(value)
|
|
|
|
? ComposeType.Reply
|
|
|
|
: value
|
|
|
|
)
|
|
|
|
},
|
|
|
|
|
|
|
|
messageVisibility: () => !this.messageLoadingThrottle() && !!this.message(),
|
|
|
|
|
|
|
|
canBeRepliedOrForwarded: () => !this.isDraftFolder() && this.messageVisibility(),
|
|
|
|
|
|
|
|
viewFromDkimVisibility: () => 'none' !== this.viewFromDkimData()[0],
|
|
|
|
|
|
|
|
viewFromDkimStatusIconClass:() => {
|
|
|
|
switch (this.viewFromDkimData()[0]) {
|
|
|
|
case 'none':
|
|
|
|
return 'icon-none iconcolor-display-none';
|
|
|
|
case 'pass':
|
|
|
|
return 'icon-ok iconcolor-green';
|
|
|
|
default:
|
|
|
|
return 'icon-warning-alt iconcolor-red';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
viewFromDkimStatusTitle:() => {
|
|
|
|
const status = this.viewFromDkimData();
|
|
|
|
if (Array.isNotEmpty(status)) {
|
|
|
|
if (status[0]) {
|
|
|
|
return status[1] || 'DKIM: ' + status[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
|
|
|
|
messageFocused: () => Focused.MessageView === AppStore.focusedState(),
|
|
|
|
|
|
|
|
messageListAndMessageViewLoading:
|
|
|
|
() => MessageStore.messageListCompleteLoadingThrottle() || MessageStore.messageLoadingThrottle()
|
|
|
|
});
|
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
this.addSubscribables({
|
|
|
|
showAttachmnetControls: v => this.message()
|
|
|
|
&& this.message().attachments().forEach(item => item && item.checked(!!v)),
|
|
|
|
|
|
|
|
lastReplyAction_: value => Local.set(ClientSideKeyName.LastReplyAction, value),
|
|
|
|
|
|
|
|
messageActiveDom: dom => this.bodyBackgroundColor(this.detectDomBackgroundColor(dom)),
|
|
|
|
|
|
|
|
message: message => {
|
|
|
|
this.messageActiveDom(null);
|
|
|
|
|
|
|
|
if (message) {
|
|
|
|
this.showAttachmnetControls(false);
|
|
|
|
if (Local.get(ClientSideKeyName.MessageAttachmentControls)) {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.showAttachmnetControls(true);
|
|
|
|
}, 50);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.viewHash !== message.hash) {
|
|
|
|
this.scrollMessageToTop();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.viewFolder = message.folder;
|
|
|
|
this.viewUid = message.uid;
|
|
|
|
this.viewHash = message.hash;
|
|
|
|
this.viewSubject(message.subject());
|
|
|
|
this.viewFromShort(message.fromToLine(true, true));
|
|
|
|
this.viewFromDkimData(message.fromDkimData());
|
|
|
|
this.viewToShort(message.toToLine(true, true));
|
|
|
|
this.viewFrom(message.fromToLine(false));
|
|
|
|
this.viewTo(message.toToLine(false));
|
|
|
|
this.viewCc(message.ccToLine(false));
|
|
|
|
this.viewBcc(message.bccToLine(false));
|
|
|
|
this.viewReplyTo(message.replyToToLine(false));
|
|
|
|
this.viewTimeStamp(message.dateTimeStampInUTC());
|
|
|
|
this.viewSize(message.friendlySize());
|
|
|
|
this.viewLineAsCss(message.lineAsCss());
|
|
|
|
this.viewViewLink(message.viewLink());
|
|
|
|
this.viewUnsubscribeLink(message.getFirstUnsubsribeLink());
|
|
|
|
this.viewDownloadLink(message.downloadLink());
|
|
|
|
this.viewIsImportant(message.isImportant());
|
|
|
|
this.viewIsFlagged(message.isFlagged());
|
|
|
|
} else {
|
|
|
|
MessageStore.selectorMessageSelected(null);
|
|
|
|
|
|
|
|
this.viewFolder = '';
|
|
|
|
this.viewUid = '';
|
|
|
|
this.viewHash = '';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
this.scrollMessageToTop();
|
2015-06-01 01:40:54 +08:00
|
|
|
}
|
2020-10-26 19:54:03 +08:00
|
|
|
},
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
fullScreenMode: value => $htmlCL.toggle('rl-message-fullscreen', value)
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
this.message.viewTrigger.subscribe(() => {
|
|
|
|
const message = this.message();
|
2020-10-23 21:15:54 +08:00
|
|
|
message ? this.viewIsFlagged(message.isFlagged()) : this.viewIsFlagged(false);
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
2015-06-01 01:40:54 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
this.lastReplyAction(Local.get(ClientSideKeyName.LastReplyAction) || ComposeType.Reply);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2020-09-03 18:51:15 +08:00
|
|
|
addEventListener('mailbox.message-view.toggle-full-screen', () => this.toggleFullScreen());
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2020-07-20 21:47:33 +08:00
|
|
|
this.attachmentPreview = this.attachmentPreview.bind(this);
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2016-09-03 07:19:37 +08:00
|
|
|
@command()
|
|
|
|
closeMessageCommand() {
|
|
|
|
MessageStore.message(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@command((self) => self.messageVisibility())
|
|
|
|
messageVisibilityCommand() {} // eslint-disable-line no-empty-function
|
|
|
|
|
|
|
|
@command((self) => self.messageVisibility())
|
|
|
|
messageEditCommand() {
|
|
|
|
this.editMessage();
|
|
|
|
}
|
|
|
|
|
|
|
|
@command((self) => !self.messageListAndMessageViewLoading())
|
|
|
|
goUpCommand() {
|
2020-08-15 02:35:39 +08:00
|
|
|
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-up',
|
|
|
|
{detail:Layout.NoPreview === this.layout() ? !!this.message() : true}
|
|
|
|
));
|
2016-09-03 07:19:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@command((self) => !self.messageListAndMessageViewLoading())
|
|
|
|
goDownCommand() {
|
2020-10-09 17:04:35 +08:00
|
|
|
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-down',
|
2020-08-15 02:35:39 +08:00
|
|
|
{detail:Layout.NoPreview === this.layout() ? !!this.message() : true}
|
|
|
|
));
|
2016-09-03 07:19:37 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
detectDomBackgroundColor(dom) {
|
2020-08-27 21:45:47 +08:00
|
|
|
let color = '';
|
|
|
|
|
|
|
|
if (dom) {
|
|
|
|
let limit = 5,
|
|
|
|
aC = dom;
|
|
|
|
while (!color && aC && limit--) {
|
|
|
|
let children = aC.children;
|
|
|
|
if (!children || 1 !== children.length || !children[0].matches('table,div,center')) break;
|
|
|
|
|
|
|
|
aC = children[0];
|
|
|
|
color = aC.style.backgroundColor || '';
|
|
|
|
if (!aC.matches('table')) {
|
|
|
|
color = isTransparent(color) ? '' : color;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
}
|
2014-12-06 05:01:33 +08:00
|
|
|
|
2020-08-27 21:45:47 +08:00
|
|
|
color = isTransparent(color) ? '' : color;
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2015-04-15 06:27:10 +08:00
|
|
|
|
2020-08-27 21:45:47 +08:00
|
|
|
return color;
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2015-01-18 23:26:00 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
fullScreen() {
|
|
|
|
this.fullScreenMode(true);
|
|
|
|
}
|
2015-04-25 06:15:11 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
unFullScreen() {
|
|
|
|
this.fullScreenMode(false);
|
|
|
|
}
|
2015-04-25 06:15:11 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
toggleFullScreen() {
|
2020-10-03 05:54:15 +08:00
|
|
|
try {
|
|
|
|
getSelection().removeAllRanges();
|
|
|
|
} catch (e) {} // eslint-disable-line no-empty
|
2015-01-18 23:26:00 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.fullScreenMode(!this.fullScreenMode());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} sType
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
replyOrforward(sType) {
|
2020-09-03 18:51:15 +08:00
|
|
|
Settings.capa(Capa.Composer) && showScreenPopup(require('View/Popup/Compose'), [sType, MessageStore.message()]);
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2016-05-01 09:07:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
checkHeaderHeight() {
|
2020-08-19 18:34:05 +08:00
|
|
|
this.oHeaderDom && this.viewBodyTopValue(this.message() ? this.oHeaderDom.offsetHeight : 0);
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
// displayMailToPopup(sMailToUrl) {
|
|
|
|
// sMailToUrl = sMailToUrl.replace(/\?.+$/, '');
|
|
|
|
//
|
|
|
|
// var
|
|
|
|
// sResult = '',
|
|
|
|
// aTo = [],
|
|
|
|
// EmailModel = require('Model/Email').default,
|
|
|
|
// fParseEmailLine = function(sLine) {
|
2020-08-12 06:25:36 +08:00
|
|
|
// return sLine ? [decodeURIComponent(sLine)].map(sItem => {
|
2016-08-17 06:01:20 +08:00
|
|
|
// var oEmailModel = new EmailModel();
|
2017-09-28 01:58:15 +08:00
|
|
|
// oEmailModel.parse(sItem);
|
2020-07-28 23:20:14 +08:00
|
|
|
// return oEmailModel.email ? oEmailModel : null;
|
2020-10-03 05:54:15 +08:00
|
|
|
// }).filter(v => v) : null;
|
2016-08-17 06:01:20 +08:00
|
|
|
// }
|
|
|
|
// ;
|
|
|
|
//
|
|
|
|
// aTo = fParseEmailLine(sMailToUrl);
|
|
|
|
// sResult = aTo && aTo[0] ? aTo[0].email : '';
|
|
|
|
//
|
|
|
|
// return sResult;
|
|
|
|
// }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {Object} oAttachment
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2020-09-22 16:13:32 +08:00
|
|
|
attachmentPreview(/*attachment*/) {
|
|
|
|
/*
|
|
|
|
if (attachment && attachment.isImage() && !attachment.isLinked && this.message() && this.message().attachments()) {
|
|
|
|
const items = this.message().attachments().map(item => {
|
|
|
|
if (item && !item.isLinked && item.isImage()) {
|
|
|
|
if (item === attachment) {
|
|
|
|
index = listIndex;
|
|
|
|
}
|
|
|
|
++listIndex;
|
|
|
|
return {
|
|
|
|
src: item.linkPreview(),
|
|
|
|
msrc: item.linkThumbnail(),
|
|
|
|
title: item.fileName
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return null;
|
2020-10-03 05:54:15 +08:00
|
|
|
}).filter(v => v);
|
2020-09-22 16:13:32 +08:00
|
|
|
|
|
|
|
if (items.length) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
2016-08-17 06:01:20 +08:00
|
|
|
return true;
|
|
|
|
}
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
onBuild(dom) {
|
2020-09-03 18:51:15 +08:00
|
|
|
this.fullScreenMode.subscribe(value => value && this.message() && AppStore.focusedState(Focused.MessageView));
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-09-03 18:51:15 +08:00
|
|
|
this.showFullInfo.subscribe(value => Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0'));
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-08-30 16:30:50 +08:00
|
|
|
this.oHeaderDom = dom.querySelector('.messageItemHeader');
|
2020-08-19 18:34:05 +08:00
|
|
|
if (this.oHeaderDom) {
|
|
|
|
if (!this.resizeObserver) {
|
|
|
|
this.resizeObserver = new ResizeObserver(this.checkHeaderHeight.throttle(50).bind(this));
|
|
|
|
}
|
|
|
|
this.resizeObserver.observe(this.oHeaderDom);
|
|
|
|
} else if (this.resizeObserver) {
|
|
|
|
this.resizeObserver.disconnect();
|
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-08-30 16:30:50 +08:00
|
|
|
const eqs = (ev, s) => ev.target.closestWithin(s, dom);
|
|
|
|
dom.addEventListener('click', event => {
|
|
|
|
this.mobile && leftPanelDisabled(true);
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2020-08-30 16:30:50 +08:00
|
|
|
let el = eqs(event, 'a');
|
|
|
|
if (el) {
|
2019-07-05 03:19:24 +08:00
|
|
|
return !(
|
|
|
|
!!event &&
|
2020-08-14 04:58:41 +08:00
|
|
|
3 !== event.which &&
|
2019-07-05 03:19:24 +08:00
|
|
|
mailToHelper(
|
2020-08-30 16:30:50 +08:00
|
|
|
el.href,
|
|
|
|
Settings.capa(Capa.Composer) ? require('View/Popup/Compose') : null
|
2019-07-05 03:19:24 +08:00
|
|
|
)
|
|
|
|
);
|
2020-08-30 16:30:50 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-08-30 16:30:50 +08:00
|
|
|
if (eqs(event, '.attachmentsPlace .attachmentIconParent')) {
|
|
|
|
event.stopPropagation();
|
|
|
|
}
|
|
|
|
|
|
|
|
el = eqs(event, '.attachmentsPlace .showPreplay');
|
|
|
|
if (el) {
|
|
|
|
event.stopPropagation();
|
|
|
|
const attachment = ko.dataFor(el); // eslint-disable-line no-invalid-this
|
2019-07-05 03:19:24 +08:00
|
|
|
if (attachment && Audio.supported) {
|
|
|
|
switch (true) {
|
2016-08-17 06:01:20 +08:00
|
|
|
case Audio.supportedMp3 && attachment.isMp3():
|
|
|
|
Audio.playMp3(attachment.linkDownload(), attachment.fileName);
|
|
|
|
break;
|
|
|
|
case Audio.supportedOgg && attachment.isOgg():
|
|
|
|
Audio.playOgg(attachment.linkDownload(), attachment.fileName);
|
|
|
|
break;
|
|
|
|
case Audio.supportedWav && attachment.isWav():
|
|
|
|
Audio.playWav(attachment.linkDownload(), attachment.fileName);
|
|
|
|
break;
|
|
|
|
// no default
|
|
|
|
}
|
|
|
|
}
|
2020-08-30 16:30:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
el = eqs(event, '.attachmentsPlace .attachmentItem .attachmentNameParent');
|
|
|
|
if (el) {
|
|
|
|
const attachment = ko.dataFor(el);
|
2020-09-15 15:29:25 +08:00
|
|
|
attachment && attachment.download && rl.app.download(attachment.linkDownload());
|
2020-08-30 16:30:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (eqs(event, '.messageItemHeader .subjectParent .flagParent')) {
|
2019-07-05 03:19:24 +08:00
|
|
|
// eslint-disable-line prefer-arrow-callback
|
2020-08-30 16:30:50 +08:00
|
|
|
const message = this.message();
|
2020-09-15 15:29:25 +08:00
|
|
|
message && rl.app.messageListAction(
|
2020-10-23 21:15:54 +08:00
|
|
|
message.folder,
|
|
|
|
message.isFlagged() ? MessageSetAction.UnsetFlag : MessageSetAction.SetFlag,
|
2020-09-03 18:51:15 +08:00
|
|
|
[message]
|
|
|
|
);
|
2020-08-30 16:30:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
el = eqs(event, '.thread-list .flagParent');
|
|
|
|
if (el) {
|
2019-07-05 03:19:24 +08:00
|
|
|
// eslint-disable-line prefer-arrow-callback
|
2020-08-30 16:30:50 +08:00
|
|
|
const message = ko.dataFor(el); // eslint-disable-line no-invalid-this
|
2020-09-15 15:29:25 +08:00
|
|
|
message && message.folder && message.uid && rl.app.messageListAction(
|
2020-09-03 18:51:15 +08:00
|
|
|
message.folder,
|
2020-10-23 21:15:54 +08:00
|
|
|
message.isFlagged() ? MessageSetAction.UnsetFlag : MessageSetAction.SetFlag,
|
2020-09-03 18:51:15 +08:00
|
|
|
[message]
|
|
|
|
);
|
2016-07-01 06:50:11 +08:00
|
|
|
|
2020-08-30 16:30:50 +08:00
|
|
|
this.threadsDropdownTrigger(true);
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
return false;
|
2020-08-30 16:30:50 +08:00
|
|
|
}
|
|
|
|
});
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
AppStore.focusedState.subscribe((value) => {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (Focused.MessageView !== value) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.scrollMessageToTop();
|
|
|
|
this.scrollMessageToLeft();
|
|
|
|
}
|
|
|
|
});
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2020-09-03 18:51:15 +08:00
|
|
|
keyScopeReal.subscribe(value => this.messageDomFocused(KeyState.MessageView === value && !inFocus()));
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2020-08-30 16:30:50 +08:00
|
|
|
this.oMessageScrollerDom = dom.querySelector('.messageItem');
|
2016-07-01 06:50:11 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.initShortcuts();
|
|
|
|
}
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
escShortcuts() {
|
2020-10-02 18:40:33 +08:00
|
|
|
if (this.viewModelVisible && this.message()) {
|
2020-09-03 18:51:15 +08:00
|
|
|
const preview = Layout.NoPreview !== this.layout();
|
2019-07-05 03:19:24 +08:00
|
|
|
if (this.fullScreenMode()) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.fullScreenMode(false);
|
2016-07-01 06:50:11 +08:00
|
|
|
|
2020-09-03 18:51:15 +08:00
|
|
|
if (preview) {
|
2016-08-17 06:01:20 +08:00
|
|
|
AppStore.focusedState(Focused.MessageList);
|
|
|
|
}
|
2020-09-03 18:51:15 +08:00
|
|
|
} else if (!preview) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.message(null);
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2016-08-17 06:01:20 +08:00
|
|
|
AppStore.focusedState(Focused.MessageList);
|
|
|
|
}
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
return false;
|
|
|
|
}
|
2016-07-01 06:50:11 +08:00
|
|
|
|
|
|
|
return true;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-04-13 08:38:18 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
initShortcuts() {
|
|
|
|
// exit fullscreen, back
|
2020-09-26 16:20:24 +08:00
|
|
|
shortcuts.add('escape,backspace', '', KeyState.MessageView, this.escShortcuts.bind(this));
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
// fullscreen
|
2020-10-09 16:31:44 +08:00
|
|
|
shortcuts.add('enter,open', '', KeyState.MessageView, () => {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.toggleFullScreen();
|
2016-06-30 08:02:45 +08:00
|
|
|
return false;
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
2016-07-01 06:50:11 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
// reply
|
2020-10-09 16:31:44 +08:00
|
|
|
shortcuts.add('r,mailreply', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (MessageStore.message()) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.replyCommand();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
// replaAll
|
2020-09-26 06:02:29 +08:00
|
|
|
shortcuts.add('a', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (MessageStore.message()) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.replyAllCommand();
|
|
|
|
return false;
|
|
|
|
}
|
2020-10-09 16:31:44 +08:00
|
|
|
return true;
|
|
|
|
});
|
|
|
|
shortcuts.add('mailreply', 'shift', [KeyState.MessageList, KeyState.MessageView], () => {
|
|
|
|
if (MessageStore.message()) {
|
|
|
|
this.replyAllCommand();
|
|
|
|
return false;
|
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
return true;
|
|
|
|
});
|
2014-04-08 05:03:58 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
// forward
|
2020-10-09 16:31:44 +08:00
|
|
|
shortcuts.add('f,mailforward', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (MessageStore.message()) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.forwardCommand();
|
|
|
|
return false;
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
|
|
|
// message information
|
2020-09-26 06:02:29 +08:00
|
|
|
shortcuts.add('i', 'meta', [KeyState.MessageList, KeyState.MessageView], () => {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (MessageStore.message()) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.showFullInfo(!this.showFullInfo());
|
2014-11-20 07:25:39 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
// toggle message blockquotes
|
2020-09-26 06:02:29 +08:00
|
|
|
shortcuts.add('b', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
2020-08-27 21:45:47 +08:00
|
|
|
const message = MessageStore.message();
|
|
|
|
if (message && message.body) {
|
|
|
|
message.body.querySelectorAll('.rlBlockquoteSwitcher').forEach(node => node.click());
|
2016-08-17 06:01:20 +08:00
|
|
|
return false;
|
2014-11-20 07:25:39 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
2020-09-26 16:20:24 +08:00
|
|
|
shortcuts.add('arrowup,arrowleft', 'meta', [KeyState.MessageList, KeyState.MessageView], () => {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.goUpCommand();
|
2016-06-30 08:02:45 +08:00
|
|
|
return false;
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
2016-07-01 06:50:11 +08:00
|
|
|
|
2020-09-26 16:20:24 +08:00
|
|
|
shortcuts.add('arrowdown,arrowright', 'meta', [KeyState.MessageList, KeyState.MessageView], () => {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.goDownCommand();
|
|
|
|
return false;
|
|
|
|
});
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
// print
|
2020-10-09 16:31:44 +08:00
|
|
|
shortcuts.add('p,printscreen', 'meta', [KeyState.MessageView, KeyState.MessageList], () => {
|
|
|
|
this.message() && this.message().printMessage();
|
2016-08-17 06:01:20 +08:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
// delete
|
2020-09-26 06:02:29 +08:00
|
|
|
shortcuts.add('delete', '', KeyState.MessageView, () => {
|
|
|
|
this.deleteCommand();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
shortcuts.add('delete', 'shift', KeyState.MessageView, () => {
|
|
|
|
this.deleteWithoutMoveCommand();
|
|
|
|
return false;
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
// change focused state
|
2020-09-26 06:02:29 +08:00
|
|
|
shortcuts.add('arrowleft', '', KeyState.MessageView, () => {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (!this.fullScreenMode() && this.message() && Layout.NoPreview !== this.layout()) {
|
2020-09-26 06:02:29 +08:00
|
|
|
if (this.oMessageScrollerDom && 0 < this.oMessageScrollerDom.scrollLeft) {
|
|
|
|
return true;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2020-09-26 06:02:29 +08:00
|
|
|
AppStore.focusedState(Focused.MessageList);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// shortcuts.add('tab', 'shift', KeyState.MessageView, (event, handler) => {
|
|
|
|
shortcuts.add('tab', '', KeyState.MessageView, () => {
|
|
|
|
if (!this.fullScreenMode() && this.message() && Layout.NoPreview !== this.layout()) {
|
|
|
|
AppStore.focusedState(Focused.MessageList);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isDraftFolder() {
|
2020-10-23 21:15:54 +08:00
|
|
|
return MessageStore.message() && FolderStore.draftFolder() === MessageStore.message().folder;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isSentFolder() {
|
2020-10-23 21:15:54 +08:00
|
|
|
return MessageStore.message() && FolderStore.sentFolder() === MessageStore.message().folder;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isSpamFolder() {
|
2020-10-23 21:15:54 +08:00
|
|
|
return MessageStore.message() && FolderStore.spamFolder() === MessageStore.message().folder;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isSpamDisabled() {
|
|
|
|
return MessageStore.message() && FolderStore.spamFolder() === UNUSED_OPTION_VALUE;
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isArchiveFolder() {
|
2020-10-23 21:15:54 +08:00
|
|
|
return MessageStore.message() && FolderStore.archiveFolder() === MessageStore.message().folder;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isArchiveDisabled() {
|
|
|
|
return MessageStore.message() && FolderStore.archiveFolder() === UNUSED_OPTION_VALUE;
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isDraftOrSentFolder() {
|
|
|
|
return this.isDraftFolder() || this.isSentFolder();
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
composeClick() {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (Settings.capa(Capa.Composer)) {
|
2016-08-17 06:01:20 +08:00
|
|
|
showScreenPopup(require('View/Popup/Compose'));
|
2015-04-25 06:15:11 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
editMessage() {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (Settings.capa(Capa.Composer) && MessageStore.message()) {
|
2016-08-17 06:01:20 +08:00
|
|
|
showScreenPopup(require('View/Popup/Compose'), [ComposeType.Draft, MessageStore.message()]);
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
scrollMessageToTop() {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (this.oMessageScrollerDom) {
|
2020-08-14 04:58:41 +08:00
|
|
|
if (50 < this.oMessageScrollerDom.scrollTop) {
|
|
|
|
this.oMessageScrollerDom.scrollTop = 50;
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2020-08-06 22:14:50 +08:00
|
|
|
this.oMessageScrollerDom.scrollTop = 0;
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
scrollMessageToLeft() {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (this.oMessageScrollerDom) {
|
2020-08-06 22:14:50 +08:00
|
|
|
this.oMessageScrollerDom.scrollLeft = 0;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2015-04-25 06:15:11 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
getAttachmentsHashes() {
|
|
|
|
const atts = this.message() ? this.message().attachments() : [];
|
2020-10-03 05:54:15 +08:00
|
|
|
return atts.map(item => (item && !item.isLinked && item.checked() ? item.download : '')).filter(v => v);
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
downloadAsZip() {
|
|
|
|
const hashes = this.getAttachmentsHashes();
|
2020-07-28 18:35:41 +08:00
|
|
|
if (hashes.length) {
|
2020-09-15 01:40:56 +08:00
|
|
|
Remote.attachmentsActions('Zip', hashes, this.downloadAsZipLoading)
|
2019-07-05 03:19:24 +08:00
|
|
|
.then((result) => {
|
|
|
|
if (result && result.Result && result.Result.Files && result.Result.Files[0] && result.Result.Files[0].Hash) {
|
2020-09-15 15:29:25 +08:00
|
|
|
rl.app.download(attachmentDownload(result.Result.Files[0].Hash));
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
|
|
|
this.downloadAsZipError(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() => {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.downloadAsZipError(true);
|
2019-07-05 03:19:24 +08:00
|
|
|
});
|
|
|
|
} else {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.highlightUnselectedAttachments(true);
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {MessageModel} oMessage
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
showImages(message) {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (message && message.showExternalImages) {
|
2020-08-27 21:45:47 +08:00
|
|
|
message.showExternalImages();
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
printableCheckedMessageCount() {
|
|
|
|
const cnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
|
|
|
|
return 0 < cnt ? (100 > cnt ? cnt : '99+') : ''; // eslint-disable-line no-magic-numbers
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2014-04-13 08:32:07 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {MessageModel} oMessage
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
readReceipt(oMessage) {
|
2020-07-28 23:20:14 +08:00
|
|
|
if (oMessage && oMessage.readReceipt()) {
|
2019-07-05 03:19:24 +08:00
|
|
|
Remote.sendReadReceiptMessage(
|
2020-07-30 03:49:41 +08:00
|
|
|
()=>{},
|
2020-10-23 21:15:54 +08:00
|
|
|
oMessage.folder,
|
2019-07-05 03:19:24 +08:00
|
|
|
oMessage.uid,
|
2016-08-17 06:01:20 +08:00
|
|
|
oMessage.readReceipt(),
|
2019-07-05 03:19:24 +08:00
|
|
|
i18n('READ_RECEIPT/SUBJECT', { 'SUBJECT': oMessage.subject() }),
|
|
|
|
i18n('READ_RECEIPT/BODY', { 'READ-RECEIPT': AccountStore.email() })
|
|
|
|
);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
oMessage.isReadReceipt(true);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2020-10-25 20:50:26 +08:00
|
|
|
MessageFlagsCache.store(oMessage);
|
2014-08-25 15:10:51 +08:00
|
|
|
|
2020-09-15 15:29:25 +08:00
|
|
|
rl.app.reloadFlagsCurrentMessageListAndMessageFromCache();
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-01-04 08:20:07 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
export { MessageViewMailBoxUserView, MessageViewMailBoxUserView as default };
|