diff --git a/src/public/app/services/sync.js b/src/public/app/services/sync.js index 8076a7937..c904f1d37 100644 --- a/src/public/app/services/sync.js +++ b/src/public/app/services/sync.js @@ -1,7 +1,7 @@ import server from './server.js'; import toastService from "./toast.js"; -async function syncNow() { +async function syncNow(ignoreNotConfigured = false) { const result = await server.post('sync/now'); if (result.success) { @@ -12,7 +12,9 @@ async function syncNow() { result.message = result.message.substr(0, 200) + "..."; } - toastService.showError("Sync failed: " + result.message); + if (!ignoreNotConfigured || result.errorCode !== 'NOT_CONFIGURED') { + toastService.showError("Sync failed: " + result.message); + } } } diff --git a/src/public/app/widgets/shared_switch.js b/src/public/app/widgets/shared_switch.js index e2664bdcc..5d7d8767e 100644 --- a/src/public/app/widgets/shared_switch.js +++ b/src/public/app/widgets/shared_switch.js @@ -25,7 +25,7 @@ export default class SharedSwitchWidget extends SwitchWidget { async switchOn() { await branchService.cloneNoteToNote(this.noteId, 'share'); - syncService.syncNow(); + syncService.syncNow(true); } async switchOff() { @@ -47,7 +47,7 @@ export default class SharedSwitchWidget extends SwitchWidget { await server.remove(`branches/${shareBranch.branchId}?taskId=no-progress-reporting`); - syncService.syncNow(); + syncService.syncNow(true); } async refreshWithNote(note) { diff --git a/src/services/sync.js b/src/services/sync.js index d764d1ba8..01e1a920f 100644 --- a/src/services/sync.js +++ b/src/services/sync.js @@ -26,7 +26,7 @@ async function sync() { try { return await syncMutexService.doExclusively(async () => { if (!syncOptions.isSyncSetup()) { - return { success: false, message: 'Sync not configured' }; + return { success: false, errorCode: 'NOT_CONFIGURED', message: 'Sync not configured' }; } let continueSync = false; diff --git a/src/services/tree.js b/src/services/tree.js index 65ff0903b..6356a4bd3 100644 --- a/src/services/tree.js +++ b/src/services/tree.js @@ -41,8 +41,6 @@ function validateParentChild(parentNoteId, childNoteId, branchId = null) { const existing = getExistingBranch(parentNoteId, childNoteId); - console.log("BBBB", existing); - if (existing && (branchId === null || existing.branchId !== branchId)) { const parentNote = becca.getNote(parentNoteId); const childNote = becca.getNote(childNoteId);