Closed Bug 1099063 Opened 10 years ago Closed 10 years ago

[Rooms] PATCH /rooms/{token} doesn't respect optional parameters (overwrites/deletes them in the room data)

Categories

(Hello (Loop) :: Server, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: standard8, Unassigned)

References

Details

(Whiteboard: [qa?][loop-server 0.14])

Attachments

(1 file)

56 bytes, text/x-github-pull-request
alexis+bugs
: review+
standard8
: feedback+
Details | Review
The documentation for PATCH /rooms/{token} says it all items are optional: https://docs.services.mozilla.com/loop/apis.html#post-rooms-token Optional request body parameters: roomName, The name of the room. roomOwner, The room owner name. maxSize, The maximum number of people the room can handle. expiresIn, the number of hours for which the room will exist. However, if I supply a patch to adjust roomName, without also specifying maxSize, then the clientMaxSize that's returned in subsequent GET /rooms/{token} is set to "null".
Actually this bug is slightly worse than I thought - not supplying the roomOwner causes the roomOwner field to no longer be set. The only thing that appears to be ok is the expiresIn, although I've not tested trying to change that value.
Summary: [Rooms] PATCH /rooms/{token} sets "clientMaxSize" to null if the maxSize parameter is not supplied → [Rooms] PATCH /rooms/{token} doesn't respect optional parameters (overwrites/deletes them in the room data)
Hi Mark, can you please log the request body you're sending? Are you sending "null" values with the keys? I believe this could be overwriting the data on the server.
I tried to reproduce the error without success. Can you have a look at tell me if there is something I'm testing badly compared to what you're providing? https://github.com/mozilla-services/loop-server/commit/dc79e33f9aaafcb55c43351b9da7882c6e08603b
Flags: needinfo?(standard8)
The body I'm using is: {"roomName":"jkljlk"} The next get for the room comes back as: {"roomUrl":"http://localhost:3000/content/XNdiFmw2ZlU","roomName":"jkljlk","clientMaxSize":null,"creationTime":1415967507,"expiresAt":1418764491,"ctime":1416172541,"participants":[]} i.e. clientMaxSize is null, and roomOwner is missing. Using the part of your patch from your commit (map -> forEach), doesn't seem to fix it.
Flags: needinfo?(standard8)
Attached file Link to GitHub PR.
I do reproduce with this test. Now fixing in the PR.
Attachment #8525952 - Flags: review?(alexis+bugs)
Attachment #8525952 - Flags: feedback?(standard8)
Comment on attachment 8525952 [details] [review] Link to GitHub PR. I've just tested against the branch and it seems to be working fine.
Attachment #8525952 - Flags: feedback?(standard8) → feedback+
Comment on attachment 8525952 [details] [review] Link to GitHub PR. That works for me. Waiting for travis to build correctly and will merge then, thanks!
Attachment #8525952 - Flags: review?(alexis+bugs) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [qa?][loop-server 0.14]
Blocks: 1151832
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: