- Issue created by @catch
- Status changed to Needs review
over 1 year ago 8:17am 8 April 2023 - ๐ฌ๐งUnited Kingdom catch
Untested patch. Couple of things I noticed:
- type was probably originally chosen because jQuery.ajax used 'type' for GET/POST.
- Since jQuery 1.9, it allows method, which type is a direct alias/bc for, although ajax.js relies on 'type' still, likely just because it's never been updated.
- as lauriii points out in the other issue, we can't use 'method' because we already use that for replacements.
So... trying httpMethod, I changed the one reference to jQuery AJAX 'type' to 'method' too here since that makes things slightly more consistent.
Passed through my mind that we should consider renaming 'method' to 'replaceMethod' in the AJAX API too, different issue if we wanted to do that though.
- ๐ฌ๐งUnited Kingdom longwave UK
Throwing my hat into the bikeshed: these are commonly referred to as HTTP verbs, so if we can't use
method
what aboutverb
? - ๐ฉ๐ชGermany geek-merlin Freiburg, Germany
> so if we can't use method what about verb?
Good point. I would've had to scratch my head what this means though. So while technically more correct, maybe not so intuitive for some.Also, i'd prefer httpMethod over method (and verb), because it includes the context, so its meaning is not dependent on additional context.
- ๐บ๐ธUnited States bkosborne New Jersey, USA
+1 for httpMethod over verb. I appreciate the verbosity
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
โHTTP methodโ is more explicit than โmethodโ or โverbโ to my ears too.
Plus, itโs consistent with how Symfony refers to it in its route definitions.
- ๐ฌ๐งUnited Kingdom longwave UK
+++ b/core/misc/ajax.js @@ -325,12 +325,12 @@ + const httpMethod = $linkElement.data('ajax-httpMethod');
As a data attribute wouldn't this become
data-http-method
? Data attribute usually use kebab-case instead of snakeCase.I also don't see any test coverage for this :(
- Status changed to Needs work
over 1 year ago 3:18pm 19 April 2023 - ๐บ๐ธUnited States smustgrave
Just to keep it moving, sending to NW for test coverage.
- ๐ฌ๐งUnited Kingdom catch
I don't think we should add test coverage for a direct rename, there is a lot of implicit coverage of the AJAX API via views but not much explicit. Leaving needs work for #9 though.
- Status changed to Needs review
over 1 year ago 1:56pm 25 April 2023 - last update
over 1 year ago 29,300 pass - ๐ซ๐ฎFinland lauriii Finland
Addressed the feedback and updated the comments.
- Status changed to Needs work
over 1 year ago 2:02pm 25 April 2023 - ๐ฌ๐งUnited Kingdom longwave UK
+++ b/core/misc/ajax.js @@ -325,12 +325,12 @@ * In case of setting custom ajax type for link we rewrite ajax.type.
I think this comment needs updating a bit given one part of it is no longer called "type". This comment didn't really add much anyway, not sure it is needed, although it is perhaps the only documentation for this feature.
I am still concerned there is no test coverage for data-ajax-type / data-ajax-http-method but I suppose that shouldn't hold this up otherwise we have to do a deprecation dance and so that can be deferred to a followup.
- Status changed to Needs review
over 1 year ago 4:25pm 25 April 2023 - last update
over 1 year ago 29,300 pass - Status changed to RTBC
over 1 year ago 3:11pm 26 April 2023 - ๐บ๐ธUnited States smustgrave
Opened ๐ Add test coverage for data-ajax-http-method attribute Active as a follow up.
-
longwave โ
committed cb778841 on 10.1.x
Issue #3352984 by lauriii, catch, longwave, smustgrave, geek-merlin,...
-
longwave โ
committed cb778841 on 10.1.x
- Status changed to Fixed
over 1 year ago 3:17pm 26 April 2023 - ๐ฌ๐งUnited Kingdom longwave UK
Committing this now so it can get in before the alpha release.
Committed and pushed cb77884135 to 10.1.x. Thanks!
Will update the change record to mention the new property name.
- ๐ฌ๐งUnited Kingdom longwave UK
Updated https://www.drupal.org/node/3193798 โ and linked it to this issue.
Automatically closed - issue fixed for 2 weeks with no activity.