1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-12 22:57:38 +02:00

Revert "Applied prettier to code base"

This reverts commit c4f19465a6.
This commit is contained in:
Laurent Cozic
2018-03-09 20:59:12 +00:00
parent 5e8b09f5af
commit 55c5ddedf4
203 changed files with 7883 additions and 13355 deletions

View File

@ -1,7 +1,7 @@
const EncryptionService = require("lib/services/EncryptionService");
const { _ } = require("lib/locale.js");
const BaseItem = require("lib/models/BaseItem.js");
const Setting = require("lib/models/Setting.js");
const EncryptionService = require('lib/services/EncryptionService');
const { _ } = require('lib/locale.js');
const BaseItem = require('lib/models/BaseItem.js');
const Setting = require('lib/models/Setting.js');
const shared = {};
@ -18,18 +18,15 @@ shared.constructor = function(comp) {
comp.isMounted_ = false;
comp.refreshStatsIID_ = null;
};
}
shared.initState = function(comp, props) {
comp.setState(
{
masterKeys: props.masterKeys,
passwords: props.passwords ? props.passwords : {},
},
() => {
comp.checkPasswords();
}
);
comp.setState({
masterKeys: props.masterKeys,
passwords: props.passwords ? props.passwords : {},
}, () => {
comp.checkPasswords();
});
comp.refreshStats();
@ -46,12 +43,12 @@ shared.initState = function(comp, props) {
}
comp.refreshStats();
}, 3000);
};
}
shared.refreshStats = async function(comp) {
const stats = await BaseItem.encryptedItemsStats();
comp.setState({ stats: stats });
};
}
shared.checkPasswords = async function(comp) {
const passwordChecks = Object.assign({}, comp.state.passwordChecks);
@ -62,30 +59,30 @@ shared.checkPasswords = async function(comp) {
passwordChecks[mk.id] = ok;
}
comp.setState({ passwordChecks: passwordChecks });
};
}
shared.decryptedStatText = function(comp) {
const stats = comp.state.stats;
const doneCount = stats.encrypted !== null ? stats.total - stats.encrypted : "-";
const totalCount = stats.total !== null ? stats.total : "-";
return _("Decrypted items: %s / %s", doneCount, totalCount);
};
const doneCount = stats.encrypted !== null ? (stats.total - stats.encrypted) : '-';
const totalCount = stats.total !== null ? stats.total : '-';
return _('Decrypted items: %s / %s', doneCount, totalCount);
}
shared.onSavePasswordClick = function(comp, mk) {
const password = comp.state.passwords[mk.id];
if (!password) {
Setting.deleteObjectKey("encryption.passwordCache", mk.id);
Setting.deleteObjectKey('encryption.passwordCache', mk.id);
} else {
Setting.setObjectKey("encryption.passwordCache", mk.id, password);
Setting.setObjectKey('encryption.passwordCache', mk.id, password);
}
comp.checkPasswords();
};
}
shared.onPasswordChange = function(comp, mk, password) {
const passwords = comp.state.passwords;
passwords[mk.id] = password;
comp.setState({ passwords: passwords });
};
}
module.exports = shared;
module.exports = shared;