Steps to reproduce: 1. Enable LoadSearchHistoryToTheFirstLoggedUser and EnableOpacSearchHistory 2. Go to OPAC. If logged in, log out. 3. Go to search history and remove all searches if any. 4. Perform a search, make sure it appears in your search history 5. Log in and go to your search history. See that your unauthenticated search history has been added to your account's search history 6. Reload the page multiple times. See that the unauthenticated search history is re-added after each page reload, making your search history grow every time.
Created attachment 182724 [details] [review] Bug 39967: Reload session after modification Otherwise the existing $session still holds outdated data that is written on the next flush, which overwrites what has been set by C4::Search::History::set_to_session Test plan: 1. Enable LoadSearchHistoryToTheFirstLoggedUser and EnableOpacSearchHistory 2. Go to OPAC. If logged in, log out. 3. Go to search history and remove all searches if any. 4. Perform a search, make sure it appears in your search history 5. Log in and go to your search history. See that your unauthenticated search history has been added to your account's search history 6. Reload the page multiple times. See that the unauthenticated search history is *NOT* re-added after each page reload
Created attachment 182738 [details] [review] Bug 39967: Reload session after modification Otherwise the existing $session still holds outdated data that is written on the next flush, which overwrites what has been set by C4::Search::History::set_to_session Test plan: 1. Enable LoadSearchHistoryToTheFirstLoggedUser and EnableOpacSearchHistory 2. Go to OPAC. If logged in, log out. 3. Go to search history and remove all searches if any. 4. Perform a search, make sure it appears in your search history 5. Log in and go to your search history. See that your unauthenticated search history has been added to your account's search history 6. Reload the page multiple times. See that the unauthenticated search history is *NOT* re-added after each page reload Signed-off-by: David Nind <david@davidnind.com>
Testing notes (using KTD): 1. The system preferences are already enabled in KTD. 2. Replicate the problem using the steps in the bug description. 3. Apply the patch, reset_all, and run through the steps in the patch to show that it is fixed.