1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Fixed sync cancel

This commit is contained in:
Laurent Cozic 2017-07-26 21:09:33 +01:00
parent 971c3e12dc
commit 76a9264239
5 changed files with 74 additions and 4 deletions

View File

@ -76,7 +76,7 @@ class Command extends BaseCommand {
this.syncTarget_ = Setting.value('sync.target');
if (args.options.target) this.syncTarget_ = args.options.target;
if (this.syncTarget_ == Setting.SYNC_TARGET_ONEDRIVE && !reg.oneDriveApi().auth()) {
if (this.syncTarget_ == Setting.SYNC_TARGET_ONEDRIVE && !await reg.syncHasAuth(this.syncTarget_)) {
const oneDriveApiUtils = new OneDriveApiNodeUtils(reg.oneDriveApi());
const auth = await oneDriveApiUtils.oauthDance(this);
Setting.setValue('sync.3.auth', auth ? JSON.stringify(auth) : null);
@ -138,8 +138,14 @@ class Command extends BaseCommand {
vorpalUtils.redrawDone();
this.log(_('Cancelling...'));
let sync = await reg.synchronizer(target);
if (sync) sync.cancel();
if (await reg.syncHasAuth(target)) {
let sync = await reg.synchronizer(target);
if (sync) sync.cancel();
} else {
if (this.releaseLockFn_) this.releaseLockFn_();
this.releaseLockFn_ = null;
}
this.syncTarget_ = null;
}

View File

@ -380,6 +380,27 @@ msgstr ""
msgid "Non-completed ones only"
msgstr ""
msgid "Show uncompleted todos on top of the lists"
msgstr ""
msgid "Save location with notes"
msgstr ""
msgid "Synchronisation interval"
msgstr ""
#, javascript-format
msgid "%d minutes"
msgstr ""
#, javascript-format
msgid "%d hour"
msgstr ""
#, javascript-format
msgid "%d hours"
msgstr ""
msgid "Sync status (synced items / total items)"
msgstr ""

View File

@ -415,6 +415,28 @@ msgstr "Tâches non-complétées et récentes"
msgid "Non-completed ones only"
msgstr "Tâche complétée seulement"
msgid "Show uncompleted todos on top of the lists"
msgstr ""
msgid "Save location with notes"
msgstr ""
#, fuzzy
msgid "Synchronisation interval"
msgstr "Cible de la synchronisation"
#, javascript-format
msgid "%d minutes"
msgstr ""
#, javascript-format
msgid "%d hour"
msgstr ""
#, javascript-format
msgid "%d hours"
msgstr ""
msgid "Sync status (synced items / total items)"
msgstr "Status de la synchronisation (objets synchro. / total)"

View File

@ -380,6 +380,27 @@ msgstr ""
msgid "Non-completed ones only"
msgstr ""
msgid "Show uncompleted todos on top of the lists"
msgstr ""
msgid "Save location with notes"
msgstr ""
msgid "Synchronisation interval"
msgstr ""
#, javascript-format
msgid "%d minutes"
msgstr ""
#, javascript-format
msgid "%d hour"
msgstr ""
#, javascript-format
msgid "%d hours"
msgstr ""
msgid "Sync status (synced items / total items)"
msgstr ""

View File

@ -136,7 +136,7 @@ class Synchronizer {
}
cancel() {
if (this.cancelling_) return;
if (this.cancelling_ || this.state() == 'idle') return;
this.logSyncOperation('cancelling', null, null, '');
this.cancelling_ = true;