snappymail/dev/View/User/MailBox/MessageView.js

1253 lines
33 KiB
JavaScript
Raw Normal View History

2014-09-05 06:49:03 +08:00
(function () {
2014-08-25 23:49:01 +08:00
'use strict';
2014-08-20 23:03:12 +08:00
var
_ = require('_'),
2014-08-25 23:49:01 +08:00
$ = require('$'),
ko = require('ko'),
key = require('key'),
2014-08-25 15:10:51 +08:00
PhotoSwipe = require('PhotoSwipe'),
PhotoSwipeUI_Default = require('PhotoSwipeUI_Default'),
2014-09-05 06:49:03 +08:00
Consts = require('Common/Consts'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Events = require('Common/Events'),
Translator = require('Common/Translator'),
2015-04-10 16:17:49 +08:00
Audio = require('Common/Audio'),
2015-02-23 00:35:17 +08:00
Cache = require('Common/Cache'),
AppStore = require('Stores/User/App'),
2015-02-03 07:58:58 +08:00
SettingsStore = require('Stores/User/Settings'),
AccountStore = require('Stores/User/Account'),
FolderStore = require('Stores/User/Folder'),
2015-02-22 06:00:51 +08:00
MessageStore = require('Stores/User/Message'),
2014-08-21 23:08:34 +08:00
Local = require('Storage/Client'),
2015-02-23 00:35:17 +08:00
Remote = require('Remote/User/Ajax'),
2014-08-22 23:08:56 +08:00
Promises = require('Promises/User/Ajax'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
;
2014-08-20 23:03:12 +08:00
/**
* @constructor
* @extends AbstractView
2014-08-20 23:03:12 +08:00
*/
2014-10-18 21:43:44 +08:00
function MessageViewMailBoxUserView()
2014-08-20 23:03:12 +08:00
{
AbstractView.call(this, 'Right', 'MailMessageView');
2014-08-20 23:03:12 +08:00
var
self = this,
sLastEmail = '',
createCommandHelper = function (sType) {
return Utils.createCommand(self, function () {
2015-01-19 04:55:37 +08:00
this.lastReplyAction(sType);
2014-08-20 23:03:12 +08:00
this.replyOrforward(sType);
}, self.canBeRepliedOrForwarded);
}
;
2015-04-15 06:27:10 +08:00
this.oDom = null;
2015-01-18 23:26:00 +08:00
this.oHeaderDom = null;
2014-08-20 23:03:12 +08:00
this.oMessageScrollerDom = null;
this.pswp = null;
2015-02-22 06:00:51 +08:00
this.message = MessageStore.message;
this.messageListChecked = MessageStore.messageListChecked;
this.hasCheckedMessages = MessageStore.hasCheckedMessages;
this.messageListCheckedOrSelectedUidsWithSubMails = MessageStore.messageListCheckedOrSelectedUidsWithSubMails;
this.messageLoadingThrottle = MessageStore.messageLoadingThrottle;
this.messagesBodiesDom = MessageStore.messagesBodiesDom;
2015-02-03 07:58:58 +08:00
this.useThreads = SettingsStore.useThreads;
this.replySameFolder = SettingsStore.replySameFolder;
this.layout = SettingsStore.layout;
this.usePreviewPane = SettingsStore.usePreviewPane;
2015-02-22 06:00:51 +08:00
this.isMessageSelected = MessageStore.isMessageSelected;
this.messageActiveDom = MessageStore.messageActiveDom;
this.messageError = MessageStore.messageError;
2014-08-22 23:08:56 +08:00
2015-02-22 06:00:51 +08:00
this.fullScreenMode = MessageStore.messageFullScreenMode;
2014-08-20 23:03:12 +08:00
2015-03-16 05:58:50 +08:00
this.messageListOfThreadsLoading = ko.observable(false).extend({'rateLimit': 1});
2015-04-11 05:52:15 +08:00
this.allowAttachmnetControls = ko.observable(false);
this.showAttachmnetControls = ko.observable(false);
2015-04-14 02:45:09 +08:00
this.downloadAsZipLoading = ko.observable(false);
this.saveToOwnCloudLoading = ko.observable(false);
this.saveToDropboxLoading = ko.observable(false);
2015-04-11 05:52:15 +08:00
this.showAttachmnetControls.subscribe(function (bV) {
if (this.message())
{
_.each(this.message().attachments(), function (oItem) {
if (oItem)
{
oItem.checked(!!bV);
}
});
}
}, this);
2015-01-19 04:55:37 +08:00
this.lastReplyAction_ = ko.observable('');
this.lastReplyAction = ko.computed({
read: this.lastReplyAction_,
write: function (sValue) {
sValue = -1 === Utils.inArray(sValue, [
Enums.ComposeType.Reply, Enums.ComposeType.ReplyAll, Enums.ComposeType.Forward
]) ? Enums.ComposeType.Reply : sValue;
this.lastReplyAction_(sValue);
},
owner: this
});
this.lastReplyAction(Local.get(Enums.ClientSideKeyName.LastReplyAction) || Enums.ComposeType.Reply);
this.lastReplyAction_.subscribe(function (sValue) {
Local.set(Enums.ClientSideKeyName.LastReplyAction, sValue);
});
2014-08-20 23:03:12 +08:00
this.showFullInfo = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false);
this.messageDomFocused = ko.observable(false).extend({'rateLimit': 0});
this.messageVisibility = ko.computed(function () {
return !this.messageLoadingThrottle() && !!this.message();
}, this);
this.message.subscribe(function (oMessage) {
if (!oMessage)
{
2015-03-06 08:42:40 +08:00
MessageStore.selectorMessageSelected(null);
2014-08-20 23:03:12 +08:00
}
}, this);
this.canBeRepliedOrForwarded = ko.computed(function () {
var bV = this.messageVisibility();
return !this.isDraftFolder() && bV;
}, this);
2014-08-20 23:03:12 +08:00
// commands
this.closeMessage = Utils.createCommand(this, function () {
2015-02-22 06:00:51 +08:00
MessageStore.message(null);
2014-08-20 23:03:12 +08:00
});
2014-08-20 23:03:12 +08:00
this.replyCommand = createCommandHelper(Enums.ComposeType.Reply);
this.replyAllCommand = createCommandHelper(Enums.ComposeType.ReplyAll);
this.forwardCommand = createCommandHelper(Enums.ComposeType.Forward);
this.forwardAsAttachmentCommand = createCommandHelper(Enums.ComposeType.ForwardAsAttachment);
this.editAsNewCommand = createCommandHelper(Enums.ComposeType.EditAsNew);
2014-08-20 23:03:12 +08:00
this.messageVisibilityCommand = Utils.createCommand(this, Utils.emptyFunction, this.messageVisibility);
2014-03-20 00:18:28 +08:00
2014-08-20 23:03:12 +08:00
this.messageEditCommand = Utils.createCommand(this, function () {
this.editMessage();
}, this.messageVisibility);
2014-08-20 23:03:12 +08:00
this.deleteCommand = Utils.createCommand(this, function () {
2015-03-06 08:42:40 +08:00
var oMessage = this.message();
if (oMessage)
2014-08-20 23:03:12 +08:00
{
2015-03-06 08:42:40 +08:00
this.message(null);
2014-10-18 21:43:44 +08:00
require('App/User').deleteMessagesFromFolder(Enums.FolderType.Trash,
2015-03-06 08:42:40 +08:00
oMessage.folderFullNameRaw, [oMessage.uid], true);
2014-08-20 23:03:12 +08:00
}
}, this.messageVisibility);
2014-08-20 23:03:12 +08:00
this.deleteWithoutMoveCommand = Utils.createCommand(this, function () {
2015-03-06 08:42:40 +08:00
var oMessage = this.message();
if (oMessage)
2014-08-20 23:03:12 +08:00
{
2015-03-06 08:42:40 +08:00
this.message(null);
2014-10-18 21:43:44 +08:00
require('App/User').deleteMessagesFromFolder(Enums.FolderType.Trash,
2015-03-06 08:42:40 +08:00
oMessage.folderFullNameRaw, [oMessage.uid], false);
2014-08-20 23:03:12 +08:00
}
}, this.messageVisibility);
2014-08-20 23:03:12 +08:00
this.archiveCommand = Utils.createCommand(this, function () {
2015-03-06 08:42:40 +08:00
var oMessage = this.message();
if (oMessage)
2014-08-20 23:03:12 +08:00
{
2015-03-06 08:42:40 +08:00
this.message(null);
2014-10-18 21:43:44 +08:00
require('App/User').deleteMessagesFromFolder(Enums.FolderType.Archive,
2015-03-06 08:42:40 +08:00
oMessage.folderFullNameRaw, [oMessage.uid], true);
2014-08-20 23:03:12 +08:00
}
}, this.messageVisibility);
2014-08-20 23:03:12 +08:00
this.spamCommand = Utils.createCommand(this, function () {
2015-03-06 08:42:40 +08:00
var oMessage = this.message();
if (oMessage)
{
2015-03-06 08:42:40 +08:00
this.message(null);
2014-10-18 21:43:44 +08:00
require('App/User').deleteMessagesFromFolder(Enums.FolderType.Spam,
2015-03-06 08:42:40 +08:00
oMessage.folderFullNameRaw, [oMessage.uid], true);
}
2014-08-20 23:03:12 +08:00
}, this.messageVisibility);
2014-08-20 23:03:12 +08:00
this.notSpamCommand = Utils.createCommand(this, function () {
2015-03-06 08:42:40 +08:00
var oMessage = this.message();
if (oMessage)
2014-08-20 23:03:12 +08:00
{
2015-03-06 08:42:40 +08:00
this.message(null);
2014-10-18 21:43:44 +08:00
require('App/User').deleteMessagesFromFolder(Enums.FolderType.NotSpam,
2015-03-06 08:42:40 +08:00
oMessage.folderFullNameRaw, [oMessage.uid], true);
2014-08-20 23:03:12 +08:00
}
}, this.messageVisibility);
// viewer
2015-01-18 23:26:00 +08:00
this.viewBodyTopValue = ko.observable(0);
2015-03-06 08:42:40 +08:00
this.viewFolder = '';
this.viewUid = '';
2014-08-20 23:03:12 +08:00
this.viewHash = '';
this.viewSubject = ko.observable('');
this.viewFromShort = ko.observable('');
2015-01-13 07:24:08 +08:00
this.viewFromDkimData = ko.observable(['none', '']);
2014-08-20 23:03:12 +08:00
this.viewToShort = ko.observable('');
this.viewFrom = ko.observable('');
this.viewTo = ko.observable('');
this.viewCc = ko.observable('');
this.viewBcc = ko.observable('');
this.viewReplyTo = ko.observable('');
2015-03-07 08:32:06 +08:00
this.viewTimeStamp = ko.observable(0);
this.viewSize = ko.observable('');
this.viewLineAsCss = ko.observable('');
2014-08-20 23:03:12 +08:00
this.viewViewLink = ko.observable('');
this.viewDownloadLink = ko.observable('');
this.viewUserPic = ko.observable(Consts.DataImages.UserDotPic);
this.viewUserPicVisible = ko.observable(false);
this.viewIsImportant = ko.observable(false);
2015-03-06 08:42:40 +08:00
this.viewIsFlagged = ko.observable(false);
// THREADS
this.viewThreads = ko.observableArray([]);
this.viewThreads.trigger = ko.observable(false);
2015-04-15 06:27:10 +08:00
this.viewThreadMessages = MessageStore.messageThreadList;
this.viewThreadMessages.error = ko.observable('');
2015-03-31 01:41:22 +08:00
this.viewThreadMessages.showMore = ko.observable(false);
this.viewThreadMessages.limit = 6;
2015-03-31 01:41:22 +08:00
this.viewThreadMessages.subscribe(function (aList) {
2015-04-15 06:27:10 +08:00
var iSelectedIndex = -1;
this.viewThreadMessages.error('');
2015-04-15 06:27:10 +08:00
if (aList && 0 < aList.length)
{
_.each(aList, function (oM, iIndex) {
if (oM && oM.selected())
{
iSelectedIndex = iIndex;
}
});
this.viewThreadMessages.showMore(this.viewThreadMessages.limit >= aList.length);
if (-1 < iSelectedIndex && !this.viewThreadMessages.showMore() &&
this.viewThreadMessages.limit < iSelectedIndex)
{
this.viewThreadMessages.showMore(true);
}
this.selectSelectedThreadMessage();
require('App/User').reloadFlagsCurrentMessageListAndMessageFromCache();
}
}, this);
2015-03-06 08:42:40 +08:00
MessageStore.messageLastThreadUidsData.subscribe(function (oData) {
if (oData && oData['Uids'])
{
oData['Uid'] = Utils.pString(oData['Uid']);
if (this.viewFolder === oData['Folder'] && this.viewUid === oData['Uid'])
{
this.viewThreads(oData['Uids']);
this.viewThreads.trigger(!this.viewThreads.trigger());
}
var oMessage = MessageStore.message();
if (oMessage && oMessage.folderFullNameRaw === oData['Folder'] && oMessage.uid === oData['Uid'])
{
oMessage.threads(oData['Uids']);
}
oMessage = _.find(MessageStore.messageList(), function (oMessage) {
return oMessage && oMessage.folderFullNameRaw === oData['Folder'] && oMessage.uid === oData['Uid'];
});
if (oMessage && oMessage.folderFullNameRaw === oData['Folder'] && oMessage.uid === oData['Uid'])
{
oMessage.threads(oData['Uids']);
}
}
}, this);
this.viewThreads.status = ko.computed(function () {
this.viewThreads.trigger();
var
iIndex = 0,
aResult = [false, '', '', '', ''],
aThreads = this.viewThreads.peek(),
iLen = aThreads.length
;
if (1 < iLen)
{
iIndex = Utils.inArray(this.viewUid, aThreads);
if (-1 < iIndex)
{
aResult[0] = true;
2015-03-10 03:42:43 +08:00
aResult[1] = (iIndex + 1) + '/' + iLen;
2015-03-06 08:42:40 +08:00
aResult[2] = aThreads[iIndex];
aResult[3] = 0 < iIndex && aThreads[iIndex - 1] ? aThreads[iIndex - 1] : '';
aResult[4] = aThreads[iIndex + 1] ? aThreads[iIndex + 1] : '';
}
}
return aResult;
}, this).extend({'notify': 'always'});
this.viewThreadsControlVisibility = ko.computed(function () {
return !!this.viewThreads.status()[0];
}, this);
this.viewThreadsControlDesc = ko.computed(function () {
return this.viewThreads.status()[1];
}, this);
this.viewThreadsControlBackAllow = ko.computed(function () {
return '' !== this.viewThreads.status()[4] && !this.messageLoadingThrottle();
}, this);
2014-08-20 23:03:12 +08:00
2015-03-06 08:42:40 +08:00
this.viewThreadsControlForwardAllow = ko.computed(function () {
return '' !== this.viewThreads.status()[3] && !this.messageLoadingThrottle();
}, this);
this.threadBackCommand = Utils.createCommand(this, function () {
var aStatus = this.viewThreads.status();
this.openThreadMessage(aStatus[4]);
}, this.viewThreadsControlBackAllow);
this.threadForwardCommand = Utils.createCommand(this, function () {
var aStatus = this.viewThreads.status();
this.openThreadMessage(aStatus[3]);
}, this.viewThreadsControlForwardAllow);
this.threadsDropdownTrigger = ko.observable(false);
2015-03-07 08:32:06 +08:00
this.threadListCommand = Utils.createCommand(this, function () {
var
self = this,
sFolder = this.viewFolder,
sUid = this.viewUid,
aUids = this.viewThreads(),
aStatus = this.viewThreads.status()
;
2015-03-07 08:32:06 +08:00
if (aStatus && aStatus[0])
{
self.viewThreadMessages([]);
2015-03-16 05:58:50 +08:00
Promises.messageListSimple(sFolder, aUids, this.messageListOfThreadsLoading).then(function (aList) {
_.each(aList, function (oItem) {
if (oItem && oItem.uid)
{
2015-04-15 06:27:10 +08:00
oItem.selected(sUid === oItem.uid);
}
});
self.viewThreadMessages(aList);
}).fail(function (iErrorCode) {
self.viewThreadMessages([]);
self.viewThreadMessages.error(Translator.getNotification(
iErrorCode, '', Enums.Notification.CantGetMessageList));
}).done();
2015-03-07 08:32:06 +08:00
}
2015-03-07 08:32:06 +08:00
}, function () {
return !this.messageLoadingThrottle() &&
!this.messageListOfThreadsLoading();
2015-03-07 08:32:06 +08:00
});
2015-03-06 08:42:40 +08:00
// PGP
2014-08-20 23:03:12 +08:00
this.viewPgpPassword = ko.observable('');
this.viewPgpSignedVerifyStatus = ko.computed(function () {
return this.message() ? this.message().pgpSignedVerifyStatus() : Enums.SignedVerifyStatus.None;
}, this);
this.viewPgpSignedVerifyUser = ko.computed(function () {
return this.message() ? this.message().pgpSignedVerifyUser() : '';
}, this);
2015-01-13 07:24:08 +08:00
this.viewFromDkimStatusIconClass = ko.computed(function () {
var sResult = 'icon-none iconcolor-display-none';
// var sResult = 'icon-warning-alt iconcolor-grey';
2015-01-13 07:24:08 +08:00
switch (this.viewFromDkimData()[0])
{
case 'none':
break;
case 'pass':
sResult = 'icon-ok iconcolor-green';
// sResult = 'icon-warning-alt iconcolor-green';
2015-01-13 07:24:08 +08:00
break;
default:
sResult = 'icon-warning-alt iconcolor-red';
break;
}
return sResult;
}, this);
this.viewFromDkimStatusTitle = ko.computed(function () {
2015-01-13 07:24:08 +08:00
var aStatus = this.viewFromDkimData();
if (Utils.isNonEmptyArray(aStatus))
{
if (aStatus[0] && aStatus[1])
{
return aStatus[1];
}
else if (aStatus[0])
{
return 'DKIM: ' + aStatus[0];
}
}
return '';
2015-01-13 07:24:08 +08:00
}, this);
2014-08-20 23:03:12 +08:00
this.message.subscribe(function (oMessage) {
this.messageActiveDom(null);
this.viewPgpPassword('');
if (oMessage)
{
2015-04-11 05:52:15 +08:00
this.showAttachmnetControls(false);
2014-08-20 23:03:12 +08:00
if (this.viewHash !== oMessage.hash)
{
2014-08-20 23:03:12 +08:00
this.scrollMessageToTop();
}
2015-03-06 08:42:40 +08:00
this.viewFolder = oMessage.folderFullNameRaw;
this.viewUid = oMessage.uid;
2014-08-20 23:03:12 +08:00
this.viewHash = oMessage.hash;
this.viewSubject(oMessage.subject());
this.viewFromShort(oMessage.fromToLine(true, true));
2015-01-13 07:24:08 +08:00
this.viewFromDkimData(oMessage.fromDkimData());
2014-08-20 23:03:12 +08:00
this.viewToShort(oMessage.toToLine(true, true));
this.viewFrom(oMessage.fromToLine(false));
this.viewTo(oMessage.toToLine(false));
this.viewCc(oMessage.ccToLine(false));
this.viewBcc(oMessage.bccToLine(false));
this.viewReplyTo(oMessage.replyToToLine(false));
2015-03-07 08:32:06 +08:00
this.viewTimeStamp(oMessage.dateTimeStampInUTC());
this.viewSize(oMessage.friendlySize());
this.viewLineAsCss(oMessage.lineAsCss());
2014-08-20 23:03:12 +08:00
this.viewViewLink(oMessage.viewLink());
this.viewDownloadLink(oMessage.downloadLink());
this.viewIsImportant(oMessage.isImportant());
2015-03-06 08:42:40 +08:00
this.viewIsFlagged(oMessage.flagged());
this.viewThreads(oMessage.threads());
this.viewThreads.trigger(!this.viewThreads.trigger());
2014-08-20 23:03:12 +08:00
sLastEmail = oMessage.fromAsSingleEmail();
2015-03-04 05:15:17 +08:00
Cache.getUserPic(sLastEmail, function (sPic, sEmail) {
if (sPic !== self.viewUserPic() && sLastEmail === sEmail)
{
2014-08-20 23:03:12 +08:00
self.viewUserPicVisible(false);
self.viewUserPic(Consts.DataImages.UserDotPic);
if ('' !== sPic)
{
self.viewUserPicVisible(true);
self.viewUserPic(sPic);
}
}
2014-08-20 23:03:12 +08:00
});
}
else
{
2015-03-06 08:42:40 +08:00
this.viewFolder = '';
this.viewUid = '';
2014-08-20 23:03:12 +08:00
this.viewHash = '';
2015-03-06 08:42:40 +08:00
this.viewThreads([]);
2014-08-20 23:03:12 +08:00
this.scrollMessageToTop();
}
}, this);
2015-03-06 08:42:40 +08:00
this.message.viewTrigger.subscribe(function () {
var oMessage = this.message();
if (oMessage)
{
this.viewIsFlagged(oMessage.flagged());
}
else
{
this.viewIsFlagged(false);
}
}, this);
2014-08-20 23:03:12 +08:00
this.fullScreenMode.subscribe(function (bValue) {
2015-04-01 01:54:11 +08:00
Globals.$html.toggleClass('rl-message-fullscreen', bValue);
2014-08-20 23:03:12 +08:00
Utils.windowResize();
});
this.messageLoadingThrottle.subscribe(Utils.windowResizeCallback);
2014-08-20 23:03:12 +08:00
this.messageFocused = ko.computed(function () {
return Enums.Focused.MessageView === AppStore.focusedState();
});
this.messageListAndMessageViewLoading = ko.computed(function () {
return MessageStore.messageListCompleteLoadingThrottle() || MessageStore.messageLoadingThrottle();
});
2014-08-20 23:03:12 +08:00
this.goUpCommand = Utils.createCommand(this, function () {
Events.pub('mailbox.message-list.selector.go-up', [
Enums.Layout.NoPreview === this.layout() ? !!this.message() : true
]);
}, function () {
return !this.messageListAndMessageViewLoading();
2014-08-20 23:03:12 +08:00
});
this.goDownCommand = Utils.createCommand(this, function () {
Events.pub('mailbox.message-list.selector.go-down', [
Enums.Layout.NoPreview === this.layout() ? !!this.message() : true
]);
}, function () {
return !this.messageListAndMessageViewLoading();
2014-08-20 23:03:12 +08:00
});
Events.sub('mailbox.message-view.toggle-full-screen', function () {
this.toggleFullScreen();
}, this);
2014-08-20 23:03:12 +08:00
kn.constructorEnd(this);
}
2014-10-18 21:43:44 +08:00
kn.extendAsViewModel(['View/User/MailBox/MessageView', 'View/App/MailBox/MessageView', 'MailBoxMessageViewViewModel'], MessageViewMailBoxUserView);
_.extend(MessageViewMailBoxUserView.prototype, AbstractView.prototype);
2014-08-20 23:03:12 +08:00
2015-03-06 08:42:40 +08:00
MessageViewMailBoxUserView.prototype.openThreadMessage = function (sUid)
{
var oMessage = this.message();
if (oMessage && sUid)
{
MessageStore.selectThreadMessage(oMessage.folderFullNameRaw, sUid);
}
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isPgpActionVisible = function ()
2014-08-20 23:03:12 +08:00
{
return Enums.SignedVerifyStatus.Success !== this.viewPgpSignedVerifyStatus();
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isPgpStatusVerifyVisible = function ()
2014-08-20 23:03:12 +08:00
{
return Enums.SignedVerifyStatus.None !== this.viewPgpSignedVerifyStatus();
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isPgpStatusVerifySuccess = function ()
2014-08-20 23:03:12 +08:00
{
return Enums.SignedVerifyStatus.Success === this.viewPgpSignedVerifyStatus();
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.pgpStatusVerifyMessage = function ()
2014-08-20 23:03:12 +08:00
{
var sResult = '';
switch (this.viewPgpSignedVerifyStatus())
{
2014-08-20 23:03:12 +08:00
case Enums.SignedVerifyStatus.UnknownPublicKeys:
sResult = Translator.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND');
2014-08-20 23:03:12 +08:00
break;
case Enums.SignedVerifyStatus.UnknownPrivateKey:
sResult = Translator.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND');
2014-08-20 23:03:12 +08:00
break;
case Enums.SignedVerifyStatus.Unverified:
sResult = Translator.i18n('PGP_NOTIFICATIONS/UNVERIFIRED_SIGNATURE');
2014-08-20 23:03:12 +08:00
break;
case Enums.SignedVerifyStatus.Error:
sResult = Translator.i18n('PGP_NOTIFICATIONS/DECRYPTION_ERROR');
2014-08-20 23:03:12 +08:00
break;
case Enums.SignedVerifyStatus.Success:
sResult = Translator.i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', {
2014-08-20 23:03:12 +08:00
'USER': this.viewPgpSignedVerifyUser()
});
break;
}
2014-08-20 23:03:12 +08:00
return sResult;
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.fullScreen = function ()
2014-08-20 23:03:12 +08:00
{
this.fullScreenMode(true);
Utils.windowResize();
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.unFullScreen = function ()
2014-08-20 23:03:12 +08:00
{
this.fullScreenMode(false);
Utils.windowResize();
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.toggleFullScreen = function ()
2014-08-20 23:03:12 +08:00
{
Utils.removeSelection();
2013-12-13 07:23:47 +08:00
2014-08-20 23:03:12 +08:00
this.fullScreenMode(!this.fullScreenMode());
Utils.windowResize();
};
2014-08-20 23:03:12 +08:00
/**
* @param {string} sType
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.replyOrforward = function (sType)
2014-08-20 23:03:12 +08:00
{
2015-02-22 06:00:51 +08:00
kn.showScreenPopup(require('View/Popup/Compose'), [sType, MessageStore.message()]);
2014-08-20 23:03:12 +08:00
};
2015-03-16 05:58:50 +08:00
MessageViewMailBoxUserView.prototype.checkHeaderHeight = function ()
{
if (this.oHeaderDom)
{
this.viewBodyTopValue(this.message() ? this.oHeaderDom.height() +
20 /* padding-(top/bottom): 20px */ + 1 /* borded-bottom: 1px */ : 0);
}
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.onBuild = function (oDom)
2014-08-20 23:03:12 +08:00
{
var
self = this,
sErrorMessage = Translator.i18n('PREVIEW_POPUP/IMAGE_ERROR'),
2015-03-16 05:58:50 +08:00
fCheckHeaderHeight = _.bind(this.checkHeaderHeight, this)
;
2015-04-15 06:27:10 +08:00
this.oDom = oDom;
2014-08-20 23:03:12 +08:00
this.fullScreenMode.subscribe(function (bValue) {
if (bValue && self.message())
2014-08-20 23:03:12 +08:00
{
AppStore.focusedState(Enums.Focused.MessageView);
2014-08-20 23:03:12 +08:00
}
}, this);
2015-01-18 23:26:00 +08:00
this.fullScreenMode.subscribe(fCheckHeaderHeight);
this.showFullInfo.subscribe(fCheckHeaderHeight);
this.message.subscribe(fCheckHeaderHeight);
Events.sub('window.resize', _.throttle(function () {
2015-01-18 23:26:00 +08:00
_.delay(fCheckHeaderHeight, 1);
_.delay(fCheckHeaderHeight, 200);
_.delay(fCheckHeaderHeight, 500);
}, 50));
2015-01-18 23:26:00 +08:00
this.showFullInfo.subscribe(function () {
Utils.windowResize();
Utils.windowResize(250);
});
this.oHeaderDom = $('.messageItemHeader', oDom);
this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null;
this.pswpDom = $('.pswp', oDom)[0];
if (this.pswpDom)
{
oDom
2014-12-28 03:48:55 +08:00
.on('click', '.attachmentImagePreview[data-index]', function (oEvent) {
var
oPs = null,
oEl = oEvent.currentTarget || null,
aItems = []
// fThumbBoundsFn = function (index) {
// var oRes = null, oEl = aItems[index], oPos = null;
// if (oEl && oEl.el)
// {
// oPos = oEl.el.find('.iconBG').offset();
// oRes = oPos && oPos.top && oPos.left ?
// {x: oPos.left, y: oPos.top, w: 60} : null;
// }
//
// return oRes;
// }
;
2014-12-28 03:48:55 +08:00
oDom.find('.attachmentImagePreview[data-index]').each(function (index, oSubElement) {
var
$oItem = $(oSubElement)
;
aItems.push({
// 'el': $oItem,
'w': 600, 'h': 400,
'src': $oItem.attr('href'),
'title': $oItem.attr('title') || ''
});
});
if (aItems && 0 < aItems.length)
{
Globals.useKeyboardShortcuts(false);
oPs = new PhotoSwipe(self.pswpDom, PhotoSwipeUI_Default, aItems, {
'index': Utils.pInt($(oEl).data('index')),
'bgOpacity': 0.85,
'loadingIndicatorDelay': 500,
'errorMsg': '<div class="pswp__error-msg">' + sErrorMessage + '</div>',
'showHideOpacity': true,
'tapToToggleControls': false,
// 'getThumbBoundsFn': fThumbBoundsFn,
'timeToIdle': 0,
'timeToIdleOutside': 0,
'history': false,
'arrowEl': 1 < aItems.length,
'counterEl': 1 < aItems.length,
'shareEl': false
});
oPs.listen('imageLoadComplete', function(index, item) {
if (item && item.img && item.img.width && item.img.height)
{
item.w = item.img.width;
item.h = item.img.height;
oPs.updateSize(true);
}
});
oPs.listen('close', function() {
Globals.useKeyboardShortcuts(true);
});
oPs.init();
}
return false;
});
}
2014-04-02 02:03:37 +08:00
2014-08-20 23:03:12 +08:00
oDom
.on('click', 'a', function (oEvent) {
// setup maito protocol
return !(!!oEvent && 3 !== oEvent['which'] && Utils.mailToHelper($(this).attr('href'), require('View/Popup/Compose')));
2014-08-20 23:03:12 +08:00
})
.on('click', '.attachmentsPlace .attachmentIconParent', function (oEvent) {
2014-08-20 23:03:12 +08:00
if (oEvent && oEvent.stopPropagation)
{
oEvent.stopPropagation();
}
})
2015-04-10 16:17:49 +08:00
.on('click', '.attachmentsPlace .showPreplay', function (oEvent) {
if (oEvent && oEvent.stopPropagation)
{
oEvent.stopPropagation();
}
var oAttachment = ko.dataFor(this);
2015-04-14 02:45:09 +08:00
if (oAttachment && Audio.supported)
2015-04-10 16:17:49 +08:00
{
2015-04-14 02:45:09 +08:00
switch (true)
{
case Audio.supportedMp3 && oAttachment.isMp3():
Audio.playMp3(oAttachment.linkDownload(), oAttachment.fileName);
break;
case Audio.supportedOgg && oAttachment.isOgg():
Audio.playOgg(oAttachment.linkDownload(), oAttachment.fileName);
break;
case Audio.supportedWav && oAttachment.isWav():
Audio.playWav(oAttachment.linkDownload(), oAttachment.fileName);
break;
}
2015-04-10 16:17:49 +08:00
}
})
.on('click', '.thread-list .more-threads', function (e) {
var oLast = null;
if (!e || 0 === e.clientX) // probably enter
{
// It's a bad bad hack :(
oLast = $('.thread-list .e-item.thread-list-message.real-msg.more-that:first a.e-link', oDom);
}
2015-03-31 01:41:22 +08:00
self.viewThreadMessages.showMore(true);
self.threadsDropdownTrigger(true);
2015-04-15 06:27:10 +08:00
if (oLast && oLast[0])
{
oLast.focus();
}
2015-03-31 01:41:22 +08:00
return false;
})
.on('click', '.thread-list .thread-list-message', function () {
var oMessage = ko.dataFor(this);
2015-03-18 20:33:48 +08:00
if (oMessage && oMessage.folder && oMessage.uid)
{
self.openThreadMessage(oMessage.uid);
}
})
.on('click', '.attachmentsPlace .attachmentItem .attachmentNameParent', function () {
2014-04-02 02:03:37 +08:00
2014-08-20 23:03:12 +08:00
var
oAttachment = ko.dataFor(this)
;
if (oAttachment && oAttachment.download)
{
2014-10-18 21:43:44 +08:00
require('App/User').download(oAttachment.linkDownload());
2014-08-20 23:03:12 +08:00
}
})
2015-04-15 06:27:10 +08:00
.on('click', '.messageItemHeader .subjectParent .flagParent', function () {
var oMessage = self.message();
if (oMessage)
{
require('App/User').messageListAction(oMessage.folderFullNameRaw, oMessage.uid,
oMessage.flagged() ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oMessage]);
}
})
.on('click', '.thread-list .flagParent', function () {
var oMessage = ko.dataFor(this);
if (oMessage && oMessage.folder && oMessage.uid)
{
require('App/User').messageListAction(
oMessage.folder, oMessage.uid,
oMessage.flagged() ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oMessage]);
}
self.threadsDropdownTrigger(true);
return false;
2015-03-06 08:42:40 +08:00
})
2014-08-20 23:03:12 +08:00
;
AppStore.focusedState.subscribe(function (sValue) {
if (Enums.Focused.MessageView !== sValue)
{
this.scrollMessageToTop();
this.scrollMessageToLeft();
2014-08-20 23:03:12 +08:00
}
}, this);
2014-04-02 02:03:37 +08:00
Globals.keyScopeReal.subscribe(function (sValue) {
this.messageDomFocused(Enums.KeyState.MessageView === sValue && !Utils.inFocus());
2014-08-20 23:03:12 +08:00
}, this);
2014-08-20 23:03:12 +08:00
this.oMessageScrollerDom = oDom.find('.messageItem .content');
this.oMessageScrollerDom = this.oMessageScrollerDom && this.oMessageScrollerDom[0] ? this.oMessageScrollerDom : null;
this.initShortcuts();
};
2015-04-15 06:27:10 +08:00
MessageViewMailBoxUserView.prototype.selectSelectedThreadMessage = function ()
2015-03-06 08:42:40 +08:00
{
2015-04-15 06:27:10 +08:00
var self = this;
_.delay(function () {
var oLast = self.oDom ? $('.thread-list .e-item.thread-list-message.real-msg.selected a.e-link', self.oDom) : null;
if (oLast && oLast[0])
{
oLast.focus();
}
}, 30);
2015-03-06 08:42:40 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @return {boolean}
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.escShortcuts = function ()
2014-08-20 23:03:12 +08:00
{
if (this.viewModelVisibility() && this.message())
{
2014-08-20 23:03:12 +08:00
if (this.fullScreenMode())
{
this.fullScreenMode(false);
if (Enums.Layout.NoPreview !== this.layout())
{
AppStore.focusedState(Enums.Focused.MessageList);
}
2014-08-20 23:03:12 +08:00
}
else if (Enums.Layout.NoPreview === this.layout())
2014-08-20 23:03:12 +08:00
{
this.message(null);
}
else
{
AppStore.focusedState(Enums.Focused.MessageList);
2014-08-20 23:03:12 +08:00
}
return false;
}
2014-08-20 23:03:12 +08:00
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.initShortcuts = function ()
2014-08-20 23:03:12 +08:00
{
var
2014-08-22 23:08:56 +08:00
self = this
2014-08-20 23:03:12 +08:00
;
// exit fullscreen, back
2015-04-10 06:05:49 +08:00
key('esc, backspace', Enums.KeyState.MessageView, _.bind(this.escShortcuts, this));
2014-08-20 23:03:12 +08:00
// fullscreen
key('enter', Enums.KeyState.MessageView, function () {
self.toggleFullScreen();
return false;
});
// reply
key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
2015-02-22 06:00:51 +08:00
if (MessageStore.message())
{
2014-08-20 23:03:12 +08:00
self.replyCommand();
return false;
}
2014-08-20 23:03:12 +08:00
});
// replaAll
key('a', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
2015-02-22 06:00:51 +08:00
if (MessageStore.message())
{
2014-08-20 23:03:12 +08:00
self.replyAllCommand();
return false;
}
2014-08-20 23:03:12 +08:00
});
2014-08-20 23:03:12 +08:00
// forward
key('f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
2015-02-22 06:00:51 +08:00
if (MessageStore.message())
2014-08-20 23:03:12 +08:00
{
self.forwardCommand();
return false;
}
});
// message information
// key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
2015-02-22 06:00:51 +08:00
// if (MessageStore.message())
2014-08-20 23:03:12 +08:00
// {
// self.showFullInfo(!self.showFullInfo());
// return false;
// }
// });
// toggle message blockquotes
key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
2015-02-22 06:00:51 +08:00
if (MessageStore.message() && MessageStore.message().body)
2014-08-20 23:03:12 +08:00
{
2015-02-22 06:00:51 +08:00
MessageStore.message().body.find('.rlBlockquoteSwitcher').click();
2014-08-20 23:03:12 +08:00
return false;
}
});
key('t', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (MessageStore.message() && self.viewThreadsControlVisibility())
{
self.threadsDropdownTrigger(true);
self.threadListCommand();
return false;
}
});
2015-03-06 08:42:40 +08:00
key('ctrl+up, command+up', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
2014-08-20 23:03:12 +08:00
self.goUpCommand();
return false;
});
2015-03-06 08:42:40 +08:00
key('ctrl+down, command+down', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
2014-08-20 23:03:12 +08:00
self.goDownCommand();
return false;
});
2015-03-06 08:42:40 +08:00
key('ctrl+left, command+left', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
self.threadForwardCommand();
return false;
});
key('ctrl+right, command+right', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
self.threadBackCommand();
return false;
});
2014-08-20 23:03:12 +08:00
// print
key('ctrl+p, command+p', Enums.KeyState.MessageView, function () {
if (self.message())
{
2014-08-20 23:03:12 +08:00
self.message().printMessage();
}
2014-08-20 23:03:12 +08:00
return false;
});
2014-08-20 23:03:12 +08:00
// delete
key('delete, shift+delete', Enums.KeyState.MessageView, function (event, handler) {
if (event)
{
if (handler && 'shift+delete' === handler.shortcut)
{
self.deleteWithoutMoveCommand();
}
else
{
self.deleteCommand();
}
2014-08-20 23:03:12 +08:00
return false;
}
});
2014-08-20 23:03:12 +08:00
// change focused state
key('tab, shift+tab, left', Enums.KeyState.MessageView, function (event, handler) {
if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== self.layout())
2014-08-20 23:03:12 +08:00
{
if (event && handler && 'left' === handler.shortcut)
{
if (self.oMessageScrollerDom && 0 < self.oMessageScrollerDom.scrollLeft())
{
return true;
}
AppStore.focusedState(Enums.Focused.MessageList);
}
else
{
AppStore.focusedState(Enums.Focused.MessageList);
}
}
else if (self.message() && Enums.Layout.NoPreview === self.layout() && event && handler && 'left' === handler.shortcut)
{
return true;
2014-08-20 23:03:12 +08:00
}
2014-08-20 23:03:12 +08:00
return false;
});
};
2014-08-20 23:03:12 +08:00
/**
* @return {boolean}
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isDraftFolder = function ()
{
2015-02-22 06:00:51 +08:00
return MessageStore.message() && FolderStore.draftFolder() === MessageStore.message().folderFullNameRaw;
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @return {boolean}
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isSentFolder = function ()
2014-08-20 23:03:12 +08:00
{
2015-02-22 06:00:51 +08:00
return MessageStore.message() && FolderStore.sentFolder() === MessageStore.message().folderFullNameRaw;
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @return {boolean}
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isSpamFolder = function ()
2014-08-20 23:03:12 +08:00
{
2015-02-22 06:00:51 +08:00
return MessageStore.message() && FolderStore.spamFolder() === MessageStore.message().folderFullNameRaw;
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @return {boolean}
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isSpamDisabled = function ()
2014-08-20 23:03:12 +08:00
{
2015-02-22 06:00:51 +08:00
return MessageStore.message() && FolderStore.spamFolder() === Consts.Values.UnuseOptionValue;
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @return {boolean}
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isArchiveFolder = function ()
2014-08-20 23:03:12 +08:00
{
2015-02-22 06:00:51 +08:00
return MessageStore.message() && FolderStore.archiveFolder() === MessageStore.message().folderFullNameRaw;
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @return {boolean}
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isArchiveDisabled = function ()
2014-08-20 23:03:12 +08:00
{
2015-02-22 06:00:51 +08:00
return MessageStore.message() && FolderStore.archiveFolder() === Consts.Values.UnuseOptionValue;
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @return {boolean}
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.isDraftOrSentFolder = function ()
2014-08-20 23:03:12 +08:00
{
return this.isDraftFolder() || this.isSentFolder();
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.composeClick = function ()
2014-08-20 23:03:12 +08:00
{
kn.showScreenPopup(require('View/Popup/Compose'));
2014-08-20 23:03:12 +08:00
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.editMessage = function ()
2014-08-20 23:03:12 +08:00
{
2015-02-22 06:00:51 +08:00
if (MessageStore.message())
{
2015-02-22 06:00:51 +08:00
kn.showScreenPopup(require('View/Popup/Compose'), [Enums.ComposeType.Draft, MessageStore.message()]);
}
2014-08-20 23:03:12 +08:00
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.scrollMessageToTop = function ()
2014-08-20 23:03:12 +08:00
{
if (this.oMessageScrollerDom)
{
2014-11-20 07:25:39 +08:00
if (50 < this.oMessageScrollerDom.scrollTop())
{
this.oMessageScrollerDom
.scrollTop(50)
.animate({'scrollTop': 0}, 200)
;
}
else
{
this.oMessageScrollerDom.scrollTop(0);
}
Utils.windowResize();
}
};
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.scrollMessageToLeft = function ()
{
if (this.oMessageScrollerDom)
{
this.oMessageScrollerDom.scrollLeft(0);
Utils.windowResize();
}
2014-08-20 23:03:12 +08:00
};
2015-04-14 02:45:09 +08:00
MessageViewMailBoxUserView.prototype.getAttachmentsHashes = function ()
{
return _.compact(_.map(this.message() ? this.message().attachments() : [], function (oItem) {
return oItem && oItem.checked() ? oItem.download : '';
}));
};
MessageViewMailBoxUserView.prototype.downloadAsZip = function ()
{
var aHashes = this.getAttachmentsHashes();
if (0 < aHashes.length)
{
Promises.attachmentsActions('Zip', aHashes, this.downloadAsZipLoading);
}
};
MessageViewMailBoxUserView.prototype.saveToOwnCloud = function ()
{
var aHashes = this.getAttachmentsHashes();
if (0 < aHashes.length)
{
Promises.attachmentsActions('OwnCloud', aHashes, this.saveToOwnCloudLoading);
}
};
MessageViewMailBoxUserView.prototype.saveToDropbox = function ()
{
var aHashes = this.getAttachmentsHashes();
if (0 < aHashes.length)
{
Promises.attachmentsActions('Dropbox', aHashes, this.saveToDropboxLoading);
}
};
2014-08-20 23:03:12 +08:00
/**
* @param {MessageModel} oMessage
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.showImages = function (oMessage)
2014-08-20 23:03:12 +08:00
{
if (oMessage && oMessage.showExternalImages)
{
2014-08-20 23:03:12 +08:00
oMessage.showExternalImages(true);
}
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
2015-04-14 02:45:09 +08:00
* @return {string}
2014-08-20 23:03:12 +08:00
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.printableCheckedMessageCount = function ()
2014-08-20 23:03:12 +08:00
{
var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
return 0 < iCnt ? (100 > iCnt ? iCnt : '99+') : '';
};
2014-08-20 23:03:12 +08:00
/**
* @param {MessageModel} oMessage
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.verifyPgpSignedClearMessage = function (oMessage)
2014-08-20 23:03:12 +08:00
{
if (oMessage)
{
2014-08-20 23:03:12 +08:00
oMessage.verifyPgpSignedClearMessage();
}
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @param {MessageModel} oMessage
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.decryptPgpEncryptedMessage = function (oMessage)
2014-08-20 23:03:12 +08:00
{
if (oMessage)
{
2014-08-20 23:03:12 +08:00
oMessage.decryptPgpEncryptedMessage(this.viewPgpPassword());
}
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
/**
* @param {MessageModel} oMessage
*/
2014-10-18 21:43:44 +08:00
MessageViewMailBoxUserView.prototype.readReceipt = function (oMessage)
2014-08-20 23:03:12 +08:00
{
if (oMessage && '' !== oMessage.readReceipt())
{
2014-08-21 23:08:34 +08:00
Remote.sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
2014-08-20 23:03:12 +08:00
oMessage.readReceipt(),
Translator.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}),
2015-02-03 07:58:58 +08:00
Translator.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': AccountStore.email()}));
2014-08-20 23:03:12 +08:00
oMessage.isReadReceipt(true);
2014-08-21 23:08:34 +08:00
Cache.storeMessageFlagsToCache(oMessage);
2014-08-25 15:10:51 +08:00
2014-10-18 21:43:44 +08:00
require('App/User').reloadFlagsCurrentMessageListAndMessageFromCache();
2014-08-20 23:03:12 +08:00
}
};
2014-01-04 08:20:07 +08:00
2014-10-18 21:43:44 +08:00
module.exports = MessageViewMailBoxUserView;
2014-01-04 08:20:07 +08:00
2014-09-05 06:49:03 +08:00
}());