fix: multiple settings objects created for 1 user

due to these multiple objects reset password wasn't working because
only the latest one would be encrypted with the new password
but all previous objects would require decryption
which resulted in a block while syncing
This commit is contained in:
thecodrr
2021-02-26 17:33:46 +05:00
parent c0e78aa5c9
commit dd2a065be7
5 changed files with 30 additions and 26 deletions

View File

@@ -63,12 +63,14 @@ export default class Sync {
}
async start(full, force) {
if (force) await this._db.context.write("lastSynced", 0);
let { lastSynced, token } = await this._performChecks();
if (full) var serverResponse = await this._fetch(lastSynced, token);
// we prepare local data before merging so we always have correct data
const data = await this._collector.collect(lastSynced, force);
const data = await this._collector.collect(lastSynced);
if (full) {
// merge the server response