From 2f9a71e522f1a32108358d3bb30c4bb108ce9f5a Mon Sep 17 00:00:00 2001
From: Michael Neumeier <neumeier@fortiss.org>
Date: Fri, 7 Jul 2023 20:18:39 +0000
Subject: [PATCH] Merged in NRRPLT-8899 (pull request #54)

[NRRPLT-8899] fix overlayed notification toasts

* [NRRPLT-8899] fix overlayed notification toasts


Approved-by: Viktor Vorobev
---
 src/components/dialog/notification-dialog.js | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/components/dialog/notification-dialog.js b/src/components/dialog/notification-dialog.js
index a41b299..969eb39 100644
--- a/src/components/dialog/notification-dialog.js
+++ b/src/components/dialog/notification-dialog.js
@@ -30,14 +30,24 @@ class NotificationDialog extends React.Component{
 
   onNotification(notification) {
     // avoid duplicates
-    var isIn = false;
+    var isType = false;
+    var isMsg = false;
+    var index = 0;
     this.state.notifications.forEach((notif) =>{
-      if (notification.type===notif.type
-        && notification.message===notif.message){
-        isIn = true;
+      if (notification.type===notif.type) {
+        if (notification.message===notif.message){
+          isMsg = true;
+        }
+        else {
+          index = this.state.notifications.indexOf(notif);
+          isType = true;
+        }
       }
     });
-    if (!isIn){
+    if (isType){
+      this.handleClose(index);
+    }
+    if (!isMsg){
       this.setState({
         notifications: [...this.state.notifications, notification]
       });
-- 
GitLab