Code refactoring (v2)

This commit is contained in:
RainLoop Team 2016-06-17 02:23:49 +03:00
parent 90d95d3ca4
commit 80ab02363e
29 changed files with 858 additions and 857 deletions

View file

@ -469,11 +469,12 @@
}
_.delay(function () {
LanguageStore.language.subscribe(function (sValue) {
self.langRequest(true);
Translator.reload(false, sValue, function() {
Translator.reload(false, sValue).then(function() {
self.langRequest(false);
self.bSendLanguage = true;
}, function() {
@ -481,6 +482,7 @@
});
});
}, 50);
Utils.triggerAutocompleteInputChange(true);

View file

@ -258,7 +258,7 @@
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved);
this.moveCommand = Utils.createCommand(this, Utils.emptyFunction, this.canBeMoved);
this.moveCommand = Utils.createCommand(this, Utils.noop, this.canBeMoved);
this.reloadCommand = Utils.createCommand(this, function () {
if (!MessageStore.messageListCompleteLoadingThrottleForAnimation() && this.allowReload)
@ -558,7 +558,7 @@
Cache.clearMessageFlagsFromCacheByFolder(sFolderFullNameRaw);
}
Remote.messageSetSeenToAll(Utils.emptyFunction, sFolderFullNameRaw, true);
Remote.messageSetSeenToAll(Utils.noop, sFolderFullNameRaw, true);
break;
case Enums.MessageSetAction.UnsetSeen:
oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
@ -571,7 +571,7 @@
oFolder.messageCountUnread(oFolder.messageCountAll());
Cache.clearMessageFlagsFromCacheByFolder(sFolderFullNameRaw);
}
Remote.messageSetSeenToAll(Utils.emptyFunction, sFolderFullNameRaw, false);
Remote.messageSetSeenToAll(Utils.noop, sFolderFullNameRaw, false);
break;
}
@ -784,11 +784,6 @@
{
var self = this;
// disable print
key('ctrl+p, command+p', Enums.KeyState.MessageList, function () {
return false;
});
key('enter', Enums.KeyState.MessageList, function () {
if (self.message() && self.useAutoSelect())
{

View file

@ -186,7 +186,7 @@
Local.set(Enums.ClientSideKeyName.LastReplyAction, sValue);
});
this.showFullInfo = ko.observable(false);
this.showFullInfo = ko.observable('1' === Local.get(Enums.ClientSideKeyName.MessageHeaderFullInfo));
this.moreDropdownTrigger = ko.observable(false);
this.messageDomFocused = ko.observable(false).extend({'rateLimit': 0});
@ -217,7 +217,7 @@
this.forwardAsAttachmentCommand = createCommandHelper(Enums.ComposeType.ForwardAsAttachment);
this.editAsNewCommand = createCommandHelper(Enums.ComposeType.EditAsNew);
this.messageVisibilityCommand = Utils.createCommand(this, Utils.emptyFunction, this.messageVisibility);
this.messageVisibilityCommand = Utils.createCommand(this, Utils.noop, this.messageVisibility);
this.messageEditCommand = Utils.createCommand(this, function () {
this.editMessage();
@ -672,9 +672,10 @@
_.delay(fCheckHeaderHeight, 500);
}, 50));
this.showFullInfo.subscribe(function () {
this.showFullInfo.subscribe(function (value) {
Utils.windowResize();
Utils.windowResize(250);
Local.set(Enums.ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
});
if (this.dropboxEnabled() && this.dropboxApiKey() && !window.Dropbox)
@ -873,13 +874,13 @@
});
// message information
// key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
// if (MessageStore.message())
// {
// self.showFullInfo(!self.showFullInfo());
// return false;
// }
// });
key('ctrl+i, command+i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (MessageStore.message())
{
self.showFullInfo(!self.showFullInfo());
}
return false;
});
// toggle message blockquotes
key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
@ -901,7 +902,7 @@
});
// print
key('ctrl+p, command+p', Enums.KeyState.MessageView, function () {
key('ctrl+p, command+p', [Enums.KeyState.MessageView, Enums.KeyState.MessageList], function () {
if (self.message())
{
self.message().printMessage();
@ -1199,7 +1200,7 @@
{
if (oMessage && '' !== oMessage.readReceipt())
{
Remote.sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
Remote.sendReadReceiptMessage(Utils.noop, oMessage.folderFullNameRaw, oMessage.uid,
oMessage.readReceipt(),
Translator.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}),
Translator.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': AccountStore.email()}));