From 205081c804926459b05180296d68c382486a2f3f Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 28 Oct 2019 20:44:11 +0100 Subject: [PATCH] actual fix for the not disappearing toasts --- src/public/javascripts/services/toast.js | 4 ++-- src/services/sync.js | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/public/javascripts/services/toast.js b/src/public/javascripts/services/toast.js index a09b38b02..224e6f5cd 100644 --- a/src/public/javascripts/services/toast.js +++ b/src/public/javascripts/services/toast.js @@ -33,7 +33,7 @@ function toast(options) { } function showPersistent(options) { - let $toast = $("#toast-persistent-" + options.id); + let $toast = $("#toast-" + options.id); if ($toast.length > 0) { $toast.find('.toast-body').html(options.message); @@ -50,7 +50,7 @@ function showPersistent(options) { } function closePersistent(id) { - $("#toast-persistent-" + id).toast("dispose"); + $("#toast-" + id).toast("dispose"); } function showMessage(message, delay = 2000) { diff --git a/src/services/sync.js b/src/services/sync.js index ee709b709..a951e4bb5 100644 --- a/src/services/sync.js +++ b/src/services/sync.js @@ -141,10 +141,14 @@ async function pullSync(syncContext) { log.info("Pulled " + rows.length + " changes from " + changesUri + " in " + (Date.now() - startDate.getTime()) + "ms"); - ws.syncPullInProgress(); - for (const {sync, entity} of rows) { if (!sourceIdService.isLocalSourceId(sync.sourceId)) { + if (appliedPulls === 0 && sync.entity !== 'recent_notes') { // send only for first + ws.syncPullInProgress(); + + appliedPulls++; + } + await syncUpdateService.updateEntity(sync, entity, syncContext.sourceId); } @@ -152,8 +156,6 @@ async function pullSync(syncContext) { } await setLastSyncedPull(rows[rows.length - 1].sync.id); - - appliedPulls += rows.length; } if (appliedPulls > 0) {