Bug 38302 - Inconsistent delete confirmation dialog for "Delete list" buttons
Summary: Inconsistent delete confirmation dialog for "Delete list" buttons
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Yanjun Li
QA Contact: Brendan Lawlor
URL:
Keywords: rel_25_05_candidate
Depends on:
Blocks:
 
Reported: 2024-10-30 15:23 UTC by Yanjun Li
Modified: 2024-11-18 15:44 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: String patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 38302: Add delete confirmation dialog (1.51 KB, patch)
2024-11-04 22:29 UTC, Yanjun Li
Details | Diff | Splinter Review
Bug 38302: Add delete confirmation dialog (1.56 KB, patch)
2024-11-05 23:54 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 38302: Add delete confirmation dialog (1.56 KB, patch)
2024-11-15 23:24 UTC, Yanjun Li
Details | Diff | Splinter Review
Bug 38302: (follow-up) Remove duplicate click handler and modify button class (2.47 KB, patch)
2024-11-15 23:24 UTC, Yanjun Li
Details | Diff | Splinter Review
Bug 38302: Add delete confirmation dialog (1.61 KB, patch)
2024-11-18 15:33 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 38302: (follow-up) Remove duplicate click handler and modify button class (2.53 KB, patch)
2024-11-18 15:33 UTC, Brendan Lawlor
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Yanjun Li 2024-10-30 15:23:18 UTC
In the staff interface, there're two ways to delete a list: 

1) "Delete" button in "Your lists" table
2) "Delete List" button in "Edit" dropdown

Option 2) has a confirmation dialog "Are you sure you want to delete this list?" but option 1) does not. 


To recreate: 

1. Create a list in the staff interface
2. Go to lists
3. See "Your lists" tab and find "Delete" button in "Actions" col, click "delete", no confirmation dialog pop up
4. Create another list
5. Go to lists and view the list detail
6. See "Edit" dropdown and click "Delete Lists" button, see confirmation dialog pop up
Comment 1 Yanjun Li 2024-11-04 22:29:04 UTC
Created attachment 173953 [details] [review]
Bug 38302: Add delete confirmation dialog

To test:

1. Create a list in the staff interface
2. Go to lists
3. See "Your lists" tab and find "Delete" button in "Actions" col, click "delete", no confirmation dialog pop up
4. Create another list
5. Go to lists and view the list detail
6. See "Edit" dropdown and click "Delete Lists" button, see confirmation dialog pop up
7. Apply patch
8. Try step 1 through 3 again
9. "Delete" button in "actions" column has the same confirmation dialog, and delete function works
Comment 2 Lucas Gass (lukeg) 2024-11-05 23:54:15 UTC
Created attachment 174052 [details] [review]
Bug 38302: Add delete confirmation dialog

To test:

1. Create a list in the staff interface
2. Go to lists
3. See "Your lists" tab and find "Delete" button in "Actions" col, click "delete", no confirmation dialog pop up
4. Create another list
5. Go to lists and view the list detail
6. See "Edit" dropdown and click "Delete Lists" button, see confirmation dialog pop up
7. Apply patch
8. Try step 1 through 3 again
9. "Delete" button in "actions" column has the same confirmation dialog, and delete function works

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Brendan Lawlor 2024-11-15 22:13:54 UTC
This works, but I think the code block in the patch is partly unnecessary.

It looks like the code block directly above this patch is really supposed to be the click handler for this alert with the MSG_CONFIRM_DELETE_LIST, but the class on the button is different so it never runs.

The class 'deleteshelf' is used on the opac side, but in shelves_results.tt the delete button has the class named 'delete-list' instead.

Before the patch if you git grep -n 'delete-list' you can see that it only appears in the class on the button in shelves_results.tt

I don't think the name of the class really matters, but we shouldn't have a duplicate click handler that does nothing.

Thanks for finding and fixing this bug. If you resubmit a patch without the duplicate click handler I will pass QA.
Comment 4 Yanjun Li 2024-11-15 23:24:57 UTC
Created attachment 174639 [details] [review]
Bug 38302: Add delete confirmation dialog

To test:

1. Create a list in the staff interface
2. Go to lists
3. See "Your lists" tab and find "Delete" button in "Actions" col, click "delete", no confirmation dialog pop up
4. Create another list
5. Go to lists and view the list detail
6. See "Edit" dropdown and click "Delete Lists" button, see confirmation dialog pop up
7. Apply patch
8. Try step 1 through 3 again
9. "Delete" button in "actions" column has the same confirmation dialog, and delete function works

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 5 Yanjun Li 2024-11-15 23:24:59 UTC
Created attachment 174640 [details] [review]
Bug 38302: (follow-up) Remove duplicate click handler and modify button class

This follow-up patch removes the unnecessarily added click handler, and modifies the delete button class. The confirmation dialog and delete function work.
Comment 6 Yanjun Li 2024-11-15 23:34:47 UTC
(In reply to Brendan Lawlor from comment #3)
> This works, but I think the code block in the patch is partly unnecessary.
> 
> It looks like the code block directly above this patch is really supposed to
> be the click handler for this alert with the MSG_CONFIRM_DELETE_LIST, but
> the class on the button is different so it never runs.
> 
> The class 'deleteshelf' is used on the opac side, but in shelves_results.tt
> the delete button has the class named 'delete-list' instead.
> 
> Before the patch if you git grep -n 'delete-list' you can see that it only
> appears in the class on the button in shelves_results.tt
> 
> I don't think the name of the class really matters, but we shouldn't have a
> duplicate click handler that does nothing.
> 
> Thanks for finding and fixing this bug. If you resubmit a patch without the
> duplicate click handler I will pass QA.

Hi Brendan, thank you so much for the explanation. I already deleted the duplicate click handler, and I will pay more attention next time to avoid writing duplicate code.
Comment 7 Brendan Lawlor 2024-11-18 15:33:32 UTC
Created attachment 174719 [details] [review]
Bug 38302: Add delete confirmation dialog

To test:

1. Create a list in the staff interface
2. Go to lists
3. See "Your lists" tab and find "Delete" button in "Actions" col, click "delete", no confirmation dialog pop up
4. Create another list
5. Go to lists and view the list detail
6. See "Edit" dropdown and click "Delete Lists" button, see confirmation dialog pop up
7. Apply patch
8. Try step 1 through 3 again
9. "Delete" button in "actions" column has the same confirmation dialog, and delete function works

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 8 Brendan Lawlor 2024-11-18 15:33:34 UTC
Created attachment 174720 [details] [review]
Bug 38302: (follow-up) Remove duplicate click handler and modify button class

This follow-up patch removes the unnecessarily added click handler, and modifies the delete button class. The confirmation dialog and delete function work.

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 9 Brendan Lawlor 2024-11-18 15:37:59 UTC
Trivial change, works, makes sense, qa scripts happy. Passing QA.

Thanks Yanjun!
Comment 10 Katrin Fischer 2024-11-18 15:44:14 UTC
Thanks Yanjun! As we are in feature freeze, this will have to wait until after the release, but will go into 25.05 early on!