Bug 22881

Summary: Trying to clear search history via the navbar X doesn't clear any searches
Product: Koha Reporter: Margaret Hade <margaret>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: jonathan.druart, lucas, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.00, 18.11.06
Bug Depends on: 21479    
Bug Blocks:    
Attachments: Bug 22881: Trying to clear search history via the navbar X doesn't clear any searches
Bug 22881: Trying to clear search history via the navbar X doesn't clear any searches
Bug 22881: Trying to clear search history via the navbar X doesn't clear any searches

Description Margaret Hade 2019-05-09 21:49:35 UTC
To Reproduce: 
1) Run a few keyword searches on your Opac. You can be logged in or not, the behavior is the same.
2) Go to 'My Search History' the /cgi-bin/koha/opac-search-history.pl page.
3) Delete your past searches by selecting one or multiple searches and clicking the "Remove Selected Searches" button. You'll get an alert pop-up about what you are about to delete. The searches you selected should delete successfully.
4) Look at the little "x" (next to "Search History" in the Navbar). If you click on this "x" it will give you the exact same alert pop-up, however is you say yes, delete my searches, nothing will be deleted. 

Either the little "x" should not give you the option to delete searches nor the alert message or it should clear all your saved searches; as if you hit select all and Remove. Otherwise patrons who want to delete their history will be incorrectly lead to believe it was cleared if they don't check /cgi-bin/koha/opac-search-history.pl .
Comment 1 Owen Leonard 2019-05-10 13:38:35 UTC
Created attachment 89548 [details] [review]
Bug 22881: Trying to clear search history via the navbar X doesn't clear any searches

This patch undoes a mistake introduced in my patch for Bug 21479. A
"preventDefault()" was added to the search history clear button by
mistake. The "confirmDelete" function only works if the default action
of the link is allowed to complete.

To test you must have the EnableOpacSearchHistory system preference
enabled. Apply the patch and log into the OPAC as a patron who has a
search history.

Click the "X" link in the header next to the "Search history" link.
Confirm that you want to clear your search history. The page should
refresh. Navigate to your account -> Your search history to confirm that
your search history has been cleared.
Comment 2 Jonathan Druart 2019-05-10 14:14:15 UTC
Created attachment 89549 [details] [review]
Bug 22881: Trying to clear search history via the navbar X doesn't clear any searches

This patch undoes a mistake introduced in my patch for Bug 21479. A
"preventDefault()" was added to the search history clear button by
mistake. The "confirmDelete" function only works if the default action
of the link is allowed to complete.

To test you must have the EnableOpacSearchHistory system preference
enabled. Apply the patch and log into the OPAC as a patron who has a
search history.

Click the "X" link in the header next to the "Search history" link.
Confirm that you want to clear your search history. The page should
refresh. Navigate to your account -> Your search history to confirm that
your search history has been cleared.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 3 Katrin Fischer 2019-05-11 09:15:43 UTC
Created attachment 89579 [details] [review]
Bug 22881: Trying to clear search history via the navbar X doesn't clear any searches

This patch undoes a mistake introduced in my patch for Bug 21479. A
"preventDefault()" was added to the search history clear button by
mistake. The "confirmDelete" function only works if the default action
of the link is allowed to complete.

To test you must have the EnableOpacSearchHistory system preference
enabled. Apply the patch and log into the OPAC as a patron who has a
search history.

Click the "X" link in the header next to the "Search history" link.
Confirm that you want to clear your search history. The page should
refresh. Navigate to your account -> Your search history to confirm that
your search history has been cleared.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Nick Clemens 2019-05-14 18:22:27 UTC
Awesome work all!

Pushed to master for 19.05
Comment 5 Martin Renvoize 2019-05-24 13:43:33 UTC
Pushed to 18.11.x for 18.11.06
Comment 6 Lucas Gass 2019-05-30 15:34:43 UTC
backported to 18.05.x for 18.05.13