Skip to content

Commit

Permalink
fix userSelectedTimeslot (#1125)
Browse files Browse the repository at this point in the history
* fix userSelectedTimeslot

because of `setUserSelectedTimeslot` being static (because it sets it in the session), it considers it the GET method.

By pure chance in the last 2.5 years, when going through the methods, it looked at setUST first, said it was the get method, then saw getUST and overwrote that as the GET method, but now it's seeing them in the other order, so overwrites getUST with setUST as the GET method. Because there's no ordering to the methods, just the order they happen to appear in, and we've been relying on getUST coming second.

I put it in as an edge case cause it kinda is - static method setting a thing essentially 'globally'

* comment
  • Loading branch information
michael-grace authored Aug 6, 2023
1 parent e5931d9 commit 655ad8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Classes/ServiceAPI/MyRadio_Swagger2.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,10 @@ private static function getMethodOpType($method)
$name = $method->getName();

//Note the ordering is important - create is static!
// setUserSelectedTimeslot is here too because it's a static
// method setting a 'global' (in the session) variable
if ($name === 'testCredentials'
|| $name === 'setUserSelectedTimeslot'
|| CoreUtils::startsWith($name, 'create')
|| CoreUtils::startsWith($name, 'add')
) {
Expand Down

0 comments on commit 655ad8b

Please sign in to comment.