More scrict rules

This commit is contained in:
RainLoop Team 2016-07-05 22:52:52 +03:00
parent 71b6407d61
commit fb2e492ce8
30 changed files with 126 additions and 89 deletions

View file

@ -519,7 +519,7 @@ function ComposePopupView()
_.delay(function() {
kn.showScreenPopup(require('View/Popup/Contacts'),
[true, self.sLastFocusedField]);
}, 200);
}, Enums.Magics.Time200ms);
}
}, function() {
@ -586,7 +586,7 @@ function ComposePopupView()
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.Compose;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Enums.Magics.Time200ms);
this.emailsSource = _.bind(this.emailsSource, this);
this.autosaveFunction = _.bind(this.autosaveFunction, this);
@ -613,7 +613,7 @@ ComposePopupView.prototype.autosaveFunction = function()
ComposePopupView.prototype.autosaveStart = function()
{
window.clearTimeout(this.iTimer);
this.iTimer = window.setTimeout(this.autosaveFunction, 1000 * 60 * 1);
this.iTimer = window.setTimeout(this.autosaveFunction, Enums.Magics.Time1m);
};
ComposePopupView.prototype.autosaveStop = function()
@ -1361,7 +1361,7 @@ ComposePopupView.prototype.setFocusInPopup = function()
}
}
}, 100);
}, Enums.Magics.Time100ms);
}
};
@ -1451,7 +1451,7 @@ ComposePopupView.prototype.onBuild = function()
});
Events.sub('window.resize.real', this.resizerTrigger);
Events.sub('window.resize.real', _.debounce(this.resizerTrigger, 50));
Events.sub('window.resize.real', _.debounce(this.resizerTrigger, Enums.Magics.Time50ms));
if (this.dropboxEnabled() && this.dropboxApiKey() && !window.Dropbox)
{
@ -1478,7 +1478,7 @@ ComposePopupView.prototype.onBuild = function()
{
self.oEditor.resize();
}
}, 5000);
}, Enums.Magics.Time5s);
};
ComposePopupView.prototype.driveCallback = function(sAccessToken, oData)

View file

@ -231,7 +231,7 @@ function ComposeOpenPgpPopupView()
self.submitRequest(false);
}, 10);
}, Enums.Magics.Time20ms);
}
else
{

View file

@ -290,7 +290,7 @@ function ContactsPopupView()
_.delay(function() {
kn.showScreenPopup(require('View/Popup/Compose'),
[Enums.ComposeType.Empty, null, aToEmails, aCcEmails, aBccEmails]);
}, 200);
}, Enums.Magics.Time200ms);
}
return true;
@ -338,7 +338,7 @@ function ContactsPopupView()
_.delay(function() {
self.viewSaveTrigger(bRes ? Enums.SaveSettingsStep.TrueResult : Enums.SaveSettingsStep.FalseResult);
}, 300);
}, Enums.Magics.Time350ms);
if (bRes)
{
@ -346,7 +346,7 @@ function ContactsPopupView()
_.delay(function() {
self.viewSaveTrigger(Enums.SaveSettingsStep.Idle);
}, 1000);
}, Enums.Magics.Time1s);
}
}, sRequestUid, this.viewID(), aProperties);
@ -549,13 +549,11 @@ ContactsPopupView.prototype.removeCheckedOrSelectedContactsFromList = function()
}
_.delay(function() {
_.each(aContacts, function(oContact) {
oKoContacts.remove(oContact);
Utils.delegateRunOnDestroy(oContact);
});
}, 500);
}, Enums.Magics.Time500ms);
}
};
@ -578,7 +576,7 @@ ContactsPopupView.prototype.deleteSelectedContacts = function()
*/
ContactsPopupView.prototype.deleteResponse = function(sResult, oData)
{
if (500 < (Enums.StorageResultType.Success === sResult && oData && oData.Time ? Utils.pInt(oData.Time) : 0))
if (Enums.Magics.Time500ms < (Enums.StorageResultType.Success === sResult && oData && oData.Time ? Utils.pInt(oData.Time) : 0))
{
this.reloadContactList(this.bDropPageAfterDelete);
}
@ -587,7 +585,7 @@ ContactsPopupView.prototype.deleteResponse = function(sResult, oData)
var self = this;
_.delay(function() {
self.reloadContactList(self.bDropPageAfterDelete);
}, 500);
}, Enums.Magics.Time500ms);
}
};

View file

@ -248,19 +248,18 @@ function DomainPopupView()
if (this.enableSmartPorts())
{
var iPort = Utils.pInt(this.imapPort());
sValue = Utils.pString(sValue);
switch (sValue)
switch (Utils.pString(sValue))
{
case '0':
if (993 === iPort)
if (Enums.Ports.ImapSsl === iPort)
{
this.imapPort('143');
this.imapPort(Utils.pString(Enums.Ports.Imap));
}
break;
case '1':
if (143 === iPort)
if (Enums.Ports.Imap === iPort)
{
this.imapPort('993');
this.imapPort(Utils.pString(Enums.Ports.ImapSsl));
}
break;
// no default
@ -272,25 +271,24 @@ function DomainPopupView()
if (this.enableSmartPorts())
{
var iPort = Utils.pInt(this.smtpPort());
sValue = Utils.pString(sValue);
switch (sValue)
switch (Utils.pString(sValue))
{
case '0':
if (465 === iPort || 587 === iPort)
if (Enums.Ports.SmtpSsl === iPort || Enums.Ports.SmtpStartTls === iPort)
{
this.smtpPort('25');
this.smtpPort(Utils.pString(Enums.Ports.Smtp));
}
break;
case '1':
if (25 === iPort || 587 === iPort)
if (Enums.Ports.Smtp === iPort || Enums.Ports.SmtpStartTls === iPort)
{
this.smtpPort('465');
this.smtpPort(Utils.pString(Enums.Ports.SmtpSsl));
}
break;
case '2':
if (25 === iPort || 465 === iPort)
if (Enums.Ports.Smtp === iPort || Enums.Ports.SmtpSsl === iPort)
{
this.smtpPort('587');
this.smtpPort(Utils.pString(Enums.Ports.SmtpStartTls));
}
break;
// no default
@ -398,7 +396,6 @@ DomainPopupView.prototype.onHide = function()
this.sieveSettings(false);
};
DomainPopupView.prototype.onShow = function(oDomain)
{
this.saving(false);

View file

@ -155,7 +155,6 @@ FilterPopupView.prototype.populateOptions = function()
]);
};
FilterPopupView.prototype.removeCondition = function(oConditionToDelete)
{
if (this.filter())

View file

@ -65,7 +65,7 @@ function FolderSystemPopupView()
'NullFolder': 'NullFolder'
});
}, 1000);
}, Enums.Magics.Time1s);
fCallback = function() {

View file

@ -54,7 +54,7 @@ KeyboardShortcutsHelpPopupView.prototype.onBuild = function(oDom)
return true;
}, 100));
}, Enums.Magics.Time100ms));
};
module.exports = KeyboardShortcutsHelpPopupView;

View file

@ -83,7 +83,7 @@ function MessageOpenPgpPopupView()
this.cancelCommand();
this.resultCallback(oPrivateKey);
}, this), 100);
}, this), Enums.Magics.Time100ms);
}, function() {
return !this.submitRequest();

View file

@ -3,6 +3,7 @@ var
_ = require('_'),
ko = require('ko'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
PgpStore = require('Stores/User/Pgp'),
@ -24,7 +25,7 @@ function NewOpenPgpKeyPopupView()
this.name = ko.observable('');
this.password = ko.observable('');
this.keyBitLength = ko.observable(2048);
this.keyBitLength = ko.observable(Enums.Magics.BitLength2048);
this.submitRequest = ko.observable(false);
@ -90,7 +91,7 @@ function NewOpenPgpKeyPopupView()
self.submitRequest(false);
}
}, 100);
}, Enums.Magics.Time100ms);
return true;
});
@ -108,7 +109,7 @@ NewOpenPgpKeyPopupView.prototype.clearPopup = function()
this.email('');
this.email.error(false);
this.keyBitLength(2048);
this.keyBitLength(Enums.Magics.BitLength2048);
};
NewOpenPgpKeyPopupView.prototype.onShow = function()

View file

@ -79,7 +79,7 @@ function PluginPopupView()
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.All;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Enums.Magics.Time200ms);
kn.constructorEnd(this);
}

View file

@ -91,10 +91,9 @@ function TwoFactorConfigurationPopupView()
this.viewTwoFactorStatus = ko.computed(function() {
Translator.trigger();
return Translator.i18n(
this.twoFactorStatus() ?
'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_CONFIGURED_DESC' :
'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'
return Translator.i18n(this.twoFactorStatus() ?
'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_CONFIGURED_DESC' :
'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'
);
}, this);
@ -111,7 +110,6 @@ function TwoFactorConfigurationPopupView()
kn.extendAsViewModel(['View/Popup/TwoFactorConfiguration', 'TwoFactorConfigurationPopupView'], TwoFactorConfigurationPopupView);
_.extend(TwoFactorConfigurationPopupView.prototype, AbstractView.prototype);
TwoFactorConfigurationPopupView.prototype.showSecret = function()
{
this.secreting(true);