From c9c6ea326c651406b07499342229ddca376df31b Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Wed, 25 Jul 2018 16:30:06 -0400
Subject: [PATCH] Resolve VUFIND-1291: when editing a list item, do not display
 success message if no work is done.

---
 .../VuFind/src/VuFind/Controller/MyResearchController.php  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php
index aca1a33bf7f..e0b7978b551 100644
--- a/module/VuFind/src/VuFind/Controller/MyResearchController.php
+++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php
@@ -619,6 +619,7 @@ class MyResearchController extends AbstractBase
         $tagParser = $this->serviceLocator->get('VuFind\Tags');
         $favorites = $this->serviceLocator
             ->get('VuFind\Favorites\FavoritesService');
+        $didSomething = false;
         foreach ($lists as $list) {
             $tags = $this->params()->fromPost('tags' . $list);
             $favorites->save(
@@ -629,13 +630,17 @@ class MyResearchController extends AbstractBase
                 ],
                 $user, $driver
             );
+            $didSomething = true;
         }
         // add to a new list?
         $addToList = $this->params()->fromPost('addToList');
         if ($addToList > -1) {
+            $didSomething = true;
             $favorites->save(['list' => $addToList], $user, $driver);
         }
-        $this->flashMessenger()->addMessage('edit_list_success', 'success');
+        if ($didSomething) {
+            $this->flashMessenger()->addMessage('edit_list_success', 'success');
+        }
 
         $newUrl = null === $listID
             ? $this->url()->fromRoute('myresearch-favorites')
-- 
GitLab