mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	fix non disappearing persistent toast
This commit is contained in:
		@@ -92,6 +92,7 @@ app.use((err, req, res, next) => {
 | 
				
			|||||||
        err.message.includes("Invalid package")
 | 
					        err.message.includes("Invalid package")
 | 
				
			||||||
        || (err.message.includes("Router not found for request") && err.message.includes("node_modules"))
 | 
					        || (err.message.includes("Router not found for request") && err.message.includes("node_modules"))
 | 
				
			||||||
        || (err.message.includes("Router not found for request") && err.message.includes(".js.map"))
 | 
					        || (err.message.includes("Router not found for request") && err.message.includes(".js.map"))
 | 
				
			||||||
 | 
					        || (err.message.includes("Router not found for request") && err.message.includes(".css.map"))
 | 
				
			||||||
    )) {
 | 
					    )) {
 | 
				
			||||||
        // electron 6 outputs a lot of such errors which do not seem important
 | 
					        // electron 6 outputs a lot of such errors which do not seem important
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ function toast(options) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function showPersistent(options) {
 | 
					function showPersistent(options) {
 | 
				
			||||||
    let $toast = $("#toast-" + options.id);
 | 
					    let $toast = $("#toast-persistent-" + options.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($toast.length > 0) {
 | 
					    if ($toast.length > 0) {
 | 
				
			||||||
        $toast.find('.toast-body').html(options.message);
 | 
					        $toast.find('.toast-body').html(options.message);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -173,7 +173,8 @@ subscribeToMessages(message => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (message.type === 'sync-pull-finished') {
 | 
					    else if (message.type === 'sync-pull-finished') {
 | 
				
			||||||
        toastService.closePersistent('sync');
 | 
					        // this gives user a chance to see the toast in case of fast sync finish
 | 
				
			||||||
 | 
					        setTimeout(() => toastService.closePersistent('sync'), 1000);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,6 +42,10 @@ function request(req) {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (req.url.includes(".js.map") || req.url.includes(".css.map")) {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logger.info(req.method + " " + req.url);
 | 
					    logger.info(req.method + " " + req.url);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -117,6 +117,8 @@ async function doLogin() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function pullSync(syncContext) {
 | 
					async function pullSync(syncContext) {
 | 
				
			||||||
 | 
					    let appliedPulls = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while (true) {
 | 
					    while (true) {
 | 
				
			||||||
        const lastSyncedPull = await getLastSyncedPull();
 | 
					        const lastSyncedPull = await getLastSyncedPull();
 | 
				
			||||||
        const changesUri = '/api/sync/changed?lastSyncId=' + lastSyncedPull;
 | 
					        const changesUri = '/api/sync/changed?lastSyncId=' + lastSyncedPull;
 | 
				
			||||||
@@ -150,9 +152,13 @@ async function pullSync(syncContext) {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await setLastSyncedPull(rows[rows.length - 1].sync.id);
 | 
					        await setLastSyncedPull(rows[rows.length - 1].sync.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        appliedPulls += rows.length;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (appliedPulls > 0) {
 | 
				
			||||||
        ws.syncPullFinished();
 | 
					        ws.syncPullFinished();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    log.info("Finished pull");
 | 
					    log.info("Finished pull");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user