From d32f2425a4c5cf9a3e340e1ef4f4fa2da9b21a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Thu, 16 Nov 2023 11:39:58 +0100 Subject: [PATCH] Don't display details button if message is empty --- src/notifications.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/notifications.ts b/src/notifications.ts index 506683e7..c1a4b7d2 100644 --- a/src/notifications.ts +++ b/src/notifications.ts @@ -28,11 +28,21 @@ export function showError( }; } +/** + * Display additional information in a dialog from a notification + * button. + * + * Note: it will not add a button if the message is empty. + * + * @param message Details to display + * @param trans Translation object + * @returns Notification option to display the message + */ export function showDetails( message: string, trans: TranslationBundle ): Notification.IOptions { - return { + return message ? { autoClose: 5000, actions: [ { @@ -45,5 +55,5 @@ export function showDetails( displayType: 'warn' } as Notification.IAction ] - }; + } : {}; }