From c333b1a63c9c0316ba9458235df18eb0a0463c0d Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@googlemail.com>
Date: Thu, 15 May 2014 02:52:54 +0200
Subject: [PATCH] in case notifications are already assigned to the view, do
 not overwrite them as there will be always none otherwise

---
 core/Plugin/Controller.php      | 9 +++++++--
 core/Plugin/ControllerAdmin.php | 7 +++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php
index af58f852ba..789c456097 100644
--- a/core/Plugin/Controller.php
+++ b/core/Plugin/Controller.php
@@ -564,8 +564,13 @@ abstract class Controller
             $this->setBasicVariablesView($view);
 
             $view->topMenu       = MenuTop::getInstance()->getMenu();
-            $view->notifications = NotificationManager::getAllNotificationsToDisplay();
-            NotificationManager::cancelAllNonPersistent();
+
+            $notifications = $view->notifications;
+            if (empty($notifications)) {
+                $view->notifications = NotificationManager::getAllNotificationsToDisplay();
+                NotificationManager::cancelAllNonPersistent();
+            }
+
         } catch (Exception $e) {
             Piwik_ExitWithMessage($e->getMessage(), $e->getTraceAsString());
         }
diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php
index 56051341ab..4f8f885ef9 100644
--- a/core/Plugin/ControllerAdmin.php
+++ b/core/Plugin/ControllerAdmin.php
@@ -178,8 +178,11 @@ abstract class ControllerAdmin extends Controller
         $adminMenu = MenuAdmin::getInstance()->getMenu();
         $view->adminMenu = $adminMenu;
 
-        $view->notifications = NotificationManager::getAllNotificationsToDisplay();
-        NotificationManager::cancelAllNonPersistent();
+        $notifications = $view->notifications;
+        if (empty($notifications)) {
+            $view->notifications = NotificationManager::getAllNotificationsToDisplay();
+            NotificationManager::cancelAllNonPersistent();
+        }
     }
 
     static public function isDataPurgeSettingsEnabled()
-- 
GitLab