nextcloud / nextcloud/RoomVox

POST /api/rooms silently ignores groupId

Open Beginner friendly
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
12
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce
  1. POST /apps/roomvox/api/rooms with a body that includes groupId:
{ "name": "Boardroom", "groupId": "building-a" }
  1. Read the created room back with GET /apps/roomvox/api/rooms/{id}.
Expected behaviour

The room belongs to room group building-a.

Actual behaviour

groupId is null. The value is silently dropped — no error, no warning.

Cause

RoomApiController::create() builds the $data array from an explicit list of
request parameters, and groupId is not among them:

https://github.com/nextcloud/RoomVox/blob/main/lib/Controller/RoomApiController.php#L225-L240

The service layer is ready for it — RoomService::createRoom() reads
$data['groupId'] ?? null (lib/Service/RoomService.php:142) — so the value is
lost in the controller before it ever gets there.

PUT /api/rooms/{id} does handle it: groupId is in $updatableFields
(RoomApiController.php:295) and is also in $nullableFields (:297), so an
update can both set and clear it.

Suggested fix

Add one line to the $data array in create():

'groupId' => $this->request->getParam('groupId', null),

Worth checking while in there: create() and update() maintain two separate
field lists that have drifted apart. active and exchangeConfig are updatable
but not settable on create either — which may well be intentional, unlike
groupId.

Workaround

Create the room first, then assign the group with PUT /api/rooms/{id}.

Impact

API and CSV-import consumers only. The admin interface is unaffected: it creates
the room and then assigns the group in a separate call, which is why this went
unnoticed.

Notes

Found while auditing docs/architecture/api-reference.md against the code. The
documentation listed groupId as a create parameter. Rather than silently
correcting the docs to match the bug, the current behaviour is now documented
with a pointer to the workaround, so the doc stays honest until this is fixed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/Controller/RoomApiController.php at create() and compare its request-parameter data with RoomService::createRoom() at lib/Service/RoomService.php:142. Exercise POST /apps/roomvox/api/rooms with groupId, then GET the created room; done means the groupId is preserved while the existing PUT behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.