From 041d798ed788bf9ecc2a8d8d476fdb59cd91cfd7 Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Sun, 22 May 2022 21:57:16 +0200
Subject: [PATCH] #699 - append to existing notifications

---
 .../deadlocker8/budgetmaster/accounts/AccountController.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/accounts/AccountController.java b/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/accounts/AccountController.java
index 367a6ee19..c97ea17f2 100644
--- a/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/accounts/AccountController.java
+++ b/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/accounts/AccountController.java
@@ -175,7 +175,9 @@ public class AccountController extends BaseController
 			// executed BEFORE this controller method and therefore the notifications list is empty in the
 			// resulting page.
 			// Quickfix: explicitly set the model attribute "notifications"
-			model.addAttribute(ModelAttributes.NOTIFICATIONS, List.of(notification));
+			final List<Notification> notifications = WebRequestUtils.getNotifications(webRequest);
+			notifications.add(notification);
+			model.addAttribute(ModelAttributes.NOTIFICATIONS, notifications);
 
 			bindingResult.addError(new FieldError("NewAccount", "state", account.getAccountState(), false, new String[]{"warning.account.edit.state"}, null, null));
 		}
-- 
GitLab