user_groups: Include group_id in success response on group creation.

Previously, the `group_id` was not returned in the success
response of the user group creation API.

This commit updates the API to return a success response
containing the unique ID of the user group with the key
`group_id`. This enhancement allows clients to easily reference
the newly created user group.

Fixes: #29686
This commit is contained in:
Aditya Kumar Kasaudhan 2024-10-26 20:25:31 +05:30 committed by Tim Abbott
parent 1ba1408b01
commit 18a8125dac
4 changed files with 33 additions and 4 deletions

View File

@ -20,6 +20,13 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 10.0 ## Changes in Zulip 10.0
**Feature level 317**
* [`POST /user_groups/create`](/api/create-user-group):
Added `group_id` to the success response of the user group creation
endpoint, enabling clients to easily access the unique identifier
of the newly created user group.
**Feature level 316** **Feature level 316**
* `PATCH /realm`, [`GET /events`](/api/get-events), * `PATCH /realm`, [`GET /events`](/api/get-events),

View File

@ -34,7 +34,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# new level means in api_docs/changelog.md, as well as "**Changes**" # new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`. # entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 316 # Last bumped for `can_move_messages_between_topics_group` API_FEATURE_LEVEL = 317 # Last bumped for inclusion of `group_id` in user group creation response.
# Bump the minor PROVISION_VERSION to indicate that folks should provision # Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump # only when going from an old version of the code to a newer version. Bump

View File

@ -20457,7 +20457,30 @@ paths:
contentType: application/json contentType: application/json
responses: responses:
"200": "200":
$ref: "#/components/responses/SimpleSuccess" description: |
A success response containing the unique ID of the user group.
This field provides a straightforward way to reference the
newly created user group.
**Changes**: New in Zulip 10.0 (feature level 317).
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/JsonSuccessBase"
- required:
- group_id
additionalProperties: false
properties:
result: {}
msg: {}
ignored_parameters_unsupported: {}
group_id:
type: integer
description: |
The unique ID of the created user group.
example: {"msg": "", "result": "success", "group_id": 123}
"400": "400":
description: Bad request. description: Bad request.
content: content:

View File

@ -101,8 +101,7 @@ def add_user_group(
add_subgroups_to_user_group( add_subgroups_to_user_group(
context.supergroup, context.direct_subgroups, acting_user=user_profile context.supergroup, context.direct_subgroups, acting_user=user_profile
) )
return json_success(request, data={"group_id": user_group.id})
return json_success(request)
@require_member_or_admin @require_member_or_admin