Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
ignore "Sync not configured" message when toggling shared state
zadamfa2ffd757448
diff --git a/src/public/app/services/sync.js b/src/public/app/services/sync.jsindex 8076a79372..c904f1d37a 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.jsindex e2664bdcc6..5d7d8767e3 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.jsindex d764d1ba8c..01e1a920f6 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.jsindex 65ff0903b6..6356a4bd31 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);