Bug 37768 - Fix form that POSTs without an op in itemtype administration
Summary: Fix form that POSTs without an op in itemtype administration
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P3 normal
Assignee: Phil Ringnalda
QA Contact: Jonathan Druart
URL:
Keywords: additional_work_needed
Depends on: 36192
Blocks: 37728
  Show dependency treegraph
 
Reported: 2024-08-29 03:54 UTC by Phil Ringnalda
Modified: 2024-09-13 10:07 UTC (History)
4 users (show)

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


Attachments
Bug 37768: Fix form that POSTs without an op in itemtype administration (2.51 KB, patch)
2024-08-29 23:27 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 37768: Fix form that POSTs without an op in itemtype administration (2.58 KB, patch)
2024-09-03 07:20 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Ringnalda 2024-08-29 03:54:26 UTC
We intend not to have forms with method="post" without an op variable (so we
can check that the op starts with "cud-" as part of the CSRF protection), but
because of bug 37728 some were missed.

For itemtype administration, that's the "No, do not delete" cancel button when you decide not to delete an itemtype, which doesn't need to POST anything since it's just taking you back to the list of itemtypes
Comment 1 Phil Ringnalda 2024-08-29 23:27:38 UTC
Created attachment 170892 [details] [review]
Bug 37768: Fix form that POSTs without an op in itemtype administration

We intend not to have forms with method="post" without an op variable (so we
can check that the op starts with "cud-" as part of the CSRF protection), but
because of bug 37728 some were missed.

For itemtype administration, that's the "No, do not delete" cancel button
when you decide not to delete an itemtype, which doesn't need to POST
anything since it's just taking you back to the list of itemtypes. The only
visible change from switching to a GET is that the URL ends with a "?" from
a GET with no params, but someone can fix that by choosing one of our various
link-as-a-cancel-button styles and switching it to a link in a bug that
doesn't block an RM_priority bug.

Test plan:
1. You aren't going to see a visible difference, so start with the patch
   applied
2. Administration - Item types
3. You need an itemtype that isn't in use to be able to delete it - ktd
   provides you with an unused Computer Files type, so click the Delete
   button for that row
4. In the "Are you sure..." page, click No, do not delete
5. Verify that you are back at the list of itemtypes, with only the "?" at
   the end of the URL to tell you that you did a GET rather than a POST

Sponsored-by: Chetco Community Public Library
Comment 2 Jonathan Druart 2024-09-02 13:36:26 UTC
Owen is this the expected UI?

Don't we want to display a link instead?
Comment 3 Phil Ringnalda 2024-09-03 00:43:34 UTC
Do we want to display a link, like we sometimes do, or a link pretending to be a button, like we sometime do, or a button being a button, like we sometimes do?

Most of these bugs blocking bug 37728 have at least one form that doesn't need to be a form, if you want to delay landing that long enough to change them.
Comment 4 Phil Ringnalda 2024-09-03 01:14:28 UTC
Oh, and most of them are loading a new page to ask for confirmation even when they don't need to look up whether they are going to disallow deleting something because it's in use, a thing which we generally ask with just a confirm popup now, do we want to switch to doing that instead?

And even for things that we won't let you delete because they are in use, we generally don't load a new page to look that up, we just don't let you delete them, like authority terms linked to bib records where there just isn't a delete button if you can't delete, should we switch that as well?
Comment 5 Jonathan Druart 2024-09-03 07:20:35 UTC
Created attachment 170958 [details] [review]
Bug 37768: Fix form that POSTs without an op in itemtype administration

We intend not to have forms with method="post" without an op variable (so we
can check that the op starts with "cud-" as part of the CSRF protection), but
because of bug 37728 some were missed.

For itemtype administration, that's the "No, do not delete" cancel button
when you decide not to delete an itemtype, which doesn't need to POST
anything since it's just taking you back to the list of itemtypes. The only
visible change from switching to a GET is that the URL ends with a "?" from
a GET with no params, but someone can fix that by choosing one of our various
link-as-a-cancel-button styles and switching it to a link in a bug that
doesn't block an RM_priority bug.

Test plan:
1. You aren't going to see a visible difference, so start with the patch
   applied
2. Administration - Item types
3. You need an itemtype that isn't in use to be able to delete it - ktd
   provides you with an unused Computer Files type, so click the Delete
   button for that row
4. In the "Are you sure..." page, click No, do not delete
5. Verify that you are back at the list of itemtypes, with only the "?" at
   the end of the URL to tell you that you did a GET rather than a POST

Sponsored-by: Chetco Community Public Library

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2024-09-03 07:21:22 UTC
Definitely not the place to fix the UI discrepancies, but would be nice to see more consistencies. I have no idea what we want however :)
Comment 7 Jonathan Druart 2024-09-03 07:22:01 UTC
Trivial, skipping QA.
Comment 8 Phil Ringnalda 2024-09-03 20:39:42 UTC
I haven't come up with a way to find all instances of this pattern, but I have 32 tabs open to the ones that were easy to find, if anyone wants to choose our One True Way to do a cancel buttonlink.
Comment 9 Jonathan Druart 2024-09-04 08:13:14 UTC
(In reply to Phil Ringnalda from comment #8)
> I haven't come up with a way to find all instances of this pattern, but I
> have 32 tabs open to the ones that were easy to find, if anyone wants to
> choose our One True Way to do a cancel buttonlink.

I discussed this with Owen (pm) and the conclusion is that "No, do not delete" is in an alert box and the use of a button is the current pattern in this case. It seems that we are consistent in Koha (always using a "yes" button and a "no" button).

Then... to go further, it's a rabbit hole.
You can start there: https://ux.stackexchange.com/questions/82492/yes-no-button-placement-on-confirmation-dialog-boxes

We could discuss it more on a separate bug report, but we will need time and energy to "fix" all of the occurrences.
Comment 10 Katrin Fischer 2024-09-13 09:27:32 UTC
I think working towards more consistency is a good goal. Could we get a bug report about the findings here so that we don't lose sight of this?
Comment 11 Katrin Fischer 2024-09-13 10:07:48 UTC
Pushed for 24.11!

Well done everyone, thank you!