Bug 38305 - Can't delete or archive suggestions
Summary: Can't delete or archive suggestions
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Owen Leonard
QA Contact: Kyle M Hall (khall)
URL:
Keywords: rel_24_05_candidate
Depends on:
Blocks:
 
Reported: 2024-10-30 18:15 UTC by Owen Leonard
Modified: 2024-11-04 15:40 UTC (History)
2 users (show)

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


Attachments
Bug 38305: Can't delete or archive suggestions (3.39 KB, patch)
2024-10-30 18:50 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 38305: Can't delete or archive suggestions (3.46 KB, patch)
2024-10-31 19:59 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 38305: Can't delete or archive suggestions (3.53 KB, patch)
2024-11-01 11:46 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 38305: Can't delete or archive suggestions (3.57 KB, patch)
2024-11-04 15:40 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2024-10-30 18:15:20 UTC
If the user has suggestions manage permission the controls for deleting and archiving suggestions do not trigger the event handler they are supposed to. The click function is too specific: it should be attached to <a> and <button>
Comment 1 Owen Leonard 2024-10-30 18:50:40 UTC
Created attachment 173738 [details] [review]
Bug 38305: Can't delete or archive suggestions

This patch corrects JS on the suggestions page so that the delete,
archive, and unarchive controls work.

The patch also modifies the markup of the "Delete" button so that it is
consisten with other pages.

To test, apply the patch and go to the suggestions page in the staff
interface.

- Log in to the staff interface as a user with "suggestions_manage"
  permission.
- If necessary, create a few suggestions to test with.
- From the table of suggestions, click the secondary menu on the "Edit"
  button for one of the suggestions.
  - Choose "Delete." You should get a confirmation dialog. Both the "OK"
    and "Cancel" options should work as expected.
  - Choose "Archive." There won't be a confirmation, and the title
    should disappear from the list.
    - To test whether the suggestion was archived, search for it using
      the sidebar form, checking the "Include archived" checkbox. The
      suggestion should show up in the list with an "Archived" label.
    - Clicking the "Edit" secondary menu on the archived suggestion
      should trigger a menu with an "Unarchive" option. Click that
      and confirm that the suggestion is no longer archived.
- Now log in as a user with only "suggestions_delete" permission but not
  "suggestions_manage"
  - In the list of suggestions each title should have a "delete" button.
    - Clicking the delete button should trigger a confirmation dialog.
      Both the "OK" and "Cancel" options should work as expected.
Comment 2 Laura Escamilla 2024-10-31 19:59:02 UTC
Created attachment 173834 [details] [review]
Bug 38305: Can't delete or archive suggestions

This patch corrects JS on the suggestions page so that the delete,
archive, and unarchive controls work.

The patch also modifies the markup of the "Delete" button so that it is
consisten with other pages.

To test, apply the patch and go to the suggestions page in the staff
interface.

- Log in to the staff interface as a user with "suggestions_manage"
  permission.
- If necessary, create a few suggestions to test with.
- From the table of suggestions, click the secondary menu on the "Edit"
  button for one of the suggestions.
  - Choose "Delete." You should get a confirmation dialog. Both the "OK"
    and "Cancel" options should work as expected.
  - Choose "Archive." There won't be a confirmation, and the title
    should disappear from the list.
    - To test whether the suggestion was archived, search for it using
      the sidebar form, checking the "Include archived" checkbox. The
      suggestion should show up in the list with an "Archived" label.
    - Clicking the "Edit" secondary menu on the archived suggestion
      should trigger a menu with an "Unarchive" option. Click that
      and confirm that the suggestion is no longer archived.
- Now log in as a user with only "suggestions_delete" permission but not
  "suggestions_manage"
  - In the list of suggestions each title should have a "delete" button.
    - Clicking the delete button should trigger a confirmation dialog.
      Both the "OK" and "Cancel" options should work as expected.

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 3 Laura Escamilla 2024-10-31 20:04:29 UTC
Hi Owen!

Thank you for this patch! There is a trivial issue I noticed, not related to your patch, that we should fix probably in another bug. In your test plan there is the step to "Choose "Delete." You should get a confirmation dialog. Both the "OK" and "Cancel" options should work as expected." Whenever "Cancel" is selected, it doesn't automatically close the secondary menu on "Edit". It keeps it open- at least on my end. In my experience the secondary menu typically closes out once a click is made on something else, such as by clicking "Cancel". Any-who this patch is great! Thanks!
Comment 4 Kyle M Hall (khall) 2024-11-01 11:46:17 UTC
Created attachment 173866 [details] [review]
Bug 38305: Can't delete or archive suggestions

This patch corrects JS on the suggestions page so that the delete,
archive, and unarchive controls work.

The patch also modifies the markup of the "Delete" button so that it is
consisten with other pages.

To test, apply the patch and go to the suggestions page in the staff
interface.

- Log in to the staff interface as a user with "suggestions_manage"
  permission.
- If necessary, create a few suggestions to test with.
- From the table of suggestions, click the secondary menu on the "Edit"
  button for one of the suggestions.
  - Choose "Delete." You should get a confirmation dialog. Both the "OK"
    and "Cancel" options should work as expected.
  - Choose "Archive." There won't be a confirmation, and the title
    should disappear from the list.
    - To test whether the suggestion was archived, search for it using
      the sidebar form, checking the "Include archived" checkbox. The
      suggestion should show up in the list with an "Archived" label.
    - Clicking the "Edit" secondary menu on the archived suggestion
      should trigger a menu with an "Unarchive" option. Click that
      and confirm that the suggestion is no longer archived.
- Now log in as a user with only "suggestions_delete" permission but not
  "suggestions_manage"
  - In the list of suggestions each title should have a "delete" button.
    - Clicking the delete button should trigger a confirmation dialog.
      Both the "OK" and "Cancel" options should work as expected.

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Katrin Fischer 2024-11-04 15:38:23 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 6 Katrin Fischer 2024-11-04 15:40:31 UTC
Created attachment 173929 [details] [review]
Bug 38305: Can't delete or archive suggestions

This patch corrects JS on the suggestions page so that the delete,
archive, and unarchive controls work.

The patch also modifies the markup of the "Delete" button so that it is
consisten with other pages.

To test, apply the patch and go to the suggestions page in the staff
interface.

- Log in to the staff interface as a user with "suggestions_manage"
  permission.
- If necessary, create a few suggestions to test with.
- From the table of suggestions, click the secondary menu on the "Edit"
  button for one of the suggestions.
  - Choose "Delete." You should get a confirmation dialog. Both the "OK"
    and "Cancel" options should work as expected.
  - Choose "Archive." There won't be a confirmation, and the title
    should disappear from the list.
    - To test whether the suggestion was archived, search for it using
      the sidebar form, checking the "Include archived" checkbox. The
      suggestion should show up in the list with an "Archived" label.
    - Clicking the "Edit" secondary menu on the archived suggestion
      should trigger a menu with an "Unarchive" option. Click that
      and confirm that the suggestion is no longer archived.
- Now log in as a user with only "suggestions_delete" permission but not
  "suggestions_manage"
  - In the list of suggestions each title should have a "delete" button.
    - Clicking the delete button should trigger a confirmation dialog.
      Both the "OK" and "Cancel" options should work as expected.

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>