Bug 39680

Summary: The navigation item "Clear” in search history doesn't delete searches
Product: Koha Reporter: Nina Martinez <nina.martinez>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: Pushed to main --- QA Contact: Julian Maurice <julian.maurice>
Severity: major    
Priority: P5 - low CC: julian.maurice, nina.martinez
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22881
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:
Bug Depends on: 34478    
Bug Blocks:    
Attachments: Bug 39680: "Clear" menu item doesn't delete search history
Bug 39680: "Clear" menu item doesn't delete search history
Bug 39680: "Clear" menu item doesn't delete search history

Description Nina Martinez 2025-04-18 14:25:39 UTC
When you try to delete your search history using this item, it asks if you are really sure. However, even if you confirm, it does not delete your history and instead just sends you to the search history summary.

We should correct this.

If you want to check this issue:

-Connect to your account.
-Make some searches.
-Try to clear your history using the "Clear Search History" item in the user menu.
-Confirm the action 
-Check if your search history is empty or not.
Comment 1 Owen Leonard 2025-05-19 11:24:35 UTC
Created attachment 182596 [details] [review]
Bug 39680: "Clear" menu item doesn't delete search history

This patch fixes the behavior of the OPAC's "Clear" link, which was not
updated to work with CSRF protection.

To test:

- If necessary, go to Administration -> System preferences in the staff
  interface and set the EnableOpacSearchHistory preference to "Keep."
- Log in to the OPAC.
- If necessary, perform several catalog searches in order to populate
  your search history.
- Expand the user menu in the upper right-hand corner and click the
  "Clear" link next to "Search history."
  - You should be prompted to confirm.
  - After confirming your search history should be empty.

Sponsored-by: Athens County Public Libraries
Comment 2 Roman Dolny 2025-05-19 14:57:49 UTC
Created attachment 182626 [details] [review]
Bug 39680: "Clear" menu item doesn't delete search history

This patch fixes the behavior of the OPAC's "Clear" link, which was not
updated to work with CSRF protection.

To test:

- If necessary, go to Administration -> System preferences in the staff
  interface and set the EnableOpacSearchHistory preference to "Keep."
- Log in to the OPAC.
- If necessary, perform several catalog searches in order to populate
  your search history.
- Expand the user menu in the upper right-hand corner and click the
  "Clear" link next to "Search history."
  - You should be prompted to confirm.
  - After confirming your search history should be empty.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Julian Maurice 2025-05-22 08:15:10 UTC
Created attachment 182719 [details] [review]
Bug 39680: "Clear" menu item doesn't delete search history

This patch fixes the behavior of the OPAC's "Clear" link, which was not
updated to work with CSRF protection.

To test:

- If necessary, go to Administration -> System preferences in the staff
  interface and set the EnableOpacSearchHistory preference to "Keep."
- Log in to the OPAC.
- If necessary, perform several catalog searches in order to populate
  your search history.
- Expand the user menu in the upper right-hand corner and click the
  "Clear" link next to "Search history."
  - You should be prompted to confirm.
  - After confirming your search history should be empty.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 4 Katrin Fischer 2025-05-22 13:25:45 UTC
Pushed for 25.05!

Well done everyone, thank you!