From 3cc24ffa00ef9b82e9b7aa52a6285140d88f6415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 6 Jun 2024 15:41:05 +0100 Subject: [PATCH] Don't show audit snackbar if all entries are all 'ok' state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I see this on a local nextcloud where the audit dialog only has one entry which is "ok". Signed-off-by: Caolán McNamara Change-Id: I55f12125cbc0ca4c88c9220ed114d455e84639e0 --- browser/src/control/Control.ServerAuditDialog.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/browser/src/control/Control.ServerAuditDialog.ts b/browser/src/control/Control.ServerAuditDialog.ts index 97f3c2b08bf8e..f6692ae1afbcf 100644 --- a/browser/src/control/Control.ServerAuditDialog.ts +++ b/browser/src/control/Control.ServerAuditDialog.ts @@ -161,8 +161,17 @@ class ServerAuditDialog { : null; if (app.serverAudit.length) { - // TODO: enable annoying snackbar later + let hasErrors = false; + app.serverAudit.forEach((entry: any) => { + if (entry.status !== 'ok') { + hasErrors = true; + } + }); + + // only show the snackbar if there are specific warnings + // and if the current view is_admin if ( + hasErrors && viewInfo && viewInfo.userextrainfo && viewInfo.userextrainfo.is_admin === true @@ -174,6 +183,7 @@ class ServerAuditDialog { ); } + // but if we any results, enable the toolbar entry for the server audit this.map.uiManager.refreshUI(); } }