Code refactoring (5) (es5 -> es2015)

This commit is contained in:
RainLoop Team 2016-07-16 00:29:42 +03:00
parent c148e19ea3
commit cec53b111f
68 changed files with 2210 additions and 2472 deletions

View file

@ -9,8 +9,7 @@ import {AbstractAppStore} from 'Stores/AbstractApp';
class AppUserStore extends AbstractAppStore
{
constructor()
{
constructor() {
super();
this.currentAudio = ko.observable('');

View file

@ -4,8 +4,7 @@ import ko from 'ko';
class IdentityUserStore
{
constructor()
{
constructor() {
this.identities = ko.observableArray([]);
this.identities.loading = ko.observable(false).extend({throttle: 100});

View file

@ -75,7 +75,10 @@ PgpUserStore.prototype.findPublicKeysBySigningKeyIds = function(aSigningKeyIds)
PgpUserStore.prototype.findPrivateKeysByEncryptionKeyIds = function(aEncryptionKeyIds, aRecipients, bReturnWrapKeys)
{
var self = this, aResult = [];
var
self = this,
aResult = [];
aResult = Utils.isArray(aEncryptionKeyIds) ? _.compact(_.flatten(_.map(aEncryptionKeyIds, function(oId) {
var oKey = oId && oId.toHex ? self.findPrivateKeyByHex(oId.toHex()) : null;
return oKey ? (bReturnWrapKeys ? [oKey] : oKey.getNativeKeys()) : [null];
@ -184,7 +187,10 @@ PgpUserStore.prototype.findSelfPrivateKey = function(sPassword)
PgpUserStore.prototype.decryptMessage = function(oMessage, aRecipients, fCallback)
{
var self = this, aPrivateKeys = [];
var
self = this,
aPrivateKeys = [];
if (oMessage && oMessage.getEncryptionKeyIds)
{
aPrivateKeys = this.findPrivateKeysByEncryptionKeyIds(oMessage.getEncryptionKeyIds(), aRecipients, true);
@ -254,7 +260,12 @@ PgpUserStore.prototype.findKeyExternal = function(sEmail, fCallback)
PgpUserStore.prototype.verifyMessage = function(oMessage, fCallback)
{
var oValid = null, aResult = [], aPublicKeys = [], aSigningKeyIds = [];
var
oValid = null,
aResult = [],
aPublicKeys = [],
aSigningKeyIds = [];
if (oMessage && oMessage.getSigningKeyIds)
{
aSigningKeyIds = oMessage.getSigningKeyIds();
@ -323,8 +334,9 @@ PgpUserStore.prototype.controlsHelper = function(mDom, oVerControl, bSuccess, sT
PgpUserStore.domControlEncryptedClickHelper = function(store, mDom, sArmoredMessage, aRecipients)
{
return function() {
var oMessage = null, $this = $(this);
var
oMessage = null,
$this = $(this);
if ($this.hasClass('success'))
{
@ -393,7 +405,10 @@ PgpUserStore.domControlSignedClickHelper = function(store, mDom, sArmoredMessage
{
return function() {
var oMessage = null, $this = $(this);
var
oMessage = null,
$this = $(this);
if ($this.hasClass('success') || $this.hasClass('error'))
{
return false;