Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

user_groups: Include group_id in success response on group creation.

Aditya Kumar Kasaudhan18a8125dac0f
diff --git a/api_docs/changelog.md b/api_docs/changelog.md
index 30a0dbeae50..a306d3a3610 100644
--- a/api_docs/changelog.md
+++ b/api_docs/changelog.md
@@ -20,6 +20,13 @@ format used by the Zulip server that they are interacting with.
## 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**
* `PATCH /realm`, [`GET /events`](/api/get-events),
diff --git a/version.py b/version.py
index a1d505fa9ed..d5826b3aafa 100644
--- a/version.py
+++ b/version.py
@@ -34,7 +34,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# new level means in api_docs/changelog.md, as well as "**Changes**"
# 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
# only when going from an old version of the code to a newer version. Bump
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index bc313f43999..1ecc82690f7 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -20457,7 +20457,30 @@ paths:
contentType: application/json
responses:
"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":
description: Bad request.
content:
diff --git a/zerver/views/user_groups.py b/zerver/views/user_groups.py
index 04bae18a125..ae2473ec421 100644
--- a/zerver/views/user_groups.py
+++ b/zerver/views/user_groups.py
@@ -101,8 +101,7 @@ def add_user_group(
add_subgroups_to_user_group(
context.supergroup, context.direct_subgroups, acting_user=user_profile
)
-
- return json_success(request)
+ return json_success(request, data={"group_id": user_group.id})
@require_member_or_admin