mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
ignore "Sync not configured" message when toggling shared state
This commit is contained in:
parent
412c745e53
commit
fa2ffd7574
@ -1,7 +1,7 @@
|
|||||||
import server from './server.js';
|
import server from './server.js';
|
||||||
import toastService from "./toast.js";
|
import toastService from "./toast.js";
|
||||||
|
|
||||||
async function syncNow() {
|
async function syncNow(ignoreNotConfigured = false) {
|
||||||
const result = await server.post('sync/now');
|
const result = await server.post('sync/now');
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
@ -12,9 +12,11 @@ async function syncNow() {
|
|||||||
result.message = result.message.substr(0, 200) + "...";
|
result.message = result.message.substr(0, 200) + "...";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ignoreNotConfigured || result.errorCode !== 'NOT_CONFIGURED') {
|
||||||
toastService.showError("Sync failed: " + result.message);
|
toastService.showError("Sync failed: " + result.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function forceNoteSync(noteId) {
|
async function forceNoteSync(noteId) {
|
||||||
await server.post('sync/force-note-sync/' + noteId);
|
await server.post('sync/force-note-sync/' + noteId);
|
||||||
|
@ -25,7 +25,7 @@ export default class SharedSwitchWidget extends SwitchWidget {
|
|||||||
async switchOn() {
|
async switchOn() {
|
||||||
await branchService.cloneNoteToNote(this.noteId, 'share');
|
await branchService.cloneNoteToNote(this.noteId, 'share');
|
||||||
|
|
||||||
syncService.syncNow();
|
syncService.syncNow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async switchOff() {
|
async switchOff() {
|
||||||
@ -47,7 +47,7 @@ export default class SharedSwitchWidget extends SwitchWidget {
|
|||||||
|
|
||||||
await server.remove(`branches/${shareBranch.branchId}?taskId=no-progress-reporting`);
|
await server.remove(`branches/${shareBranch.branchId}?taskId=no-progress-reporting`);
|
||||||
|
|
||||||
syncService.syncNow();
|
syncService.syncNow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async refreshWithNote(note) {
|
async refreshWithNote(note) {
|
||||||
|
@ -26,7 +26,7 @@ async function sync() {
|
|||||||
try {
|
try {
|
||||||
return await syncMutexService.doExclusively(async () => {
|
return await syncMutexService.doExclusively(async () => {
|
||||||
if (!syncOptions.isSyncSetup()) {
|
if (!syncOptions.isSyncSetup()) {
|
||||||
return { success: false, message: 'Sync not configured' };
|
return { success: false, errorCode: 'NOT_CONFIGURED', message: 'Sync not configured' };
|
||||||
}
|
}
|
||||||
|
|
||||||
let continueSync = false;
|
let continueSync = false;
|
||||||
|
@ -41,8 +41,6 @@ function validateParentChild(parentNoteId, childNoteId, branchId = null) {
|
|||||||
|
|
||||||
const existing = getExistingBranch(parentNoteId, childNoteId);
|
const existing = getExistingBranch(parentNoteId, childNoteId);
|
||||||
|
|
||||||
console.log("BBBB", existing);
|
|
||||||
|
|
||||||
if (existing && (branchId === null || existing.branchId !== branchId)) {
|
if (existing && (branchId === null || existing.branchId !== branchId)) {
|
||||||
const parentNote = becca.getNote(parentNoteId);
|
const parentNote = becca.getNote(parentNoteId);
|
||||||
const childNote = becca.getNote(childNoteId);
|
const childNote = becca.getNote(childNoteId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user