Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user groups: Make name and description optional in group update.
m-e-l-u-h-a-nab4e6a94c5f6
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex e992ca12865..3c56b2b8017 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,10 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 7.0+**Feature level 165**+* [`PATCH /user_groups/{user_group_id}`](/api/update-user-group): The+ `name` and `description` parameters are now optional.+**Feature level 164*** [`POST /register`](/api/register-queue): Added thediff --git a/version.py b/version.pyindex 822d0ac35bc..b1e57cac2c6 100644--- a/version.py+++ b/version.py@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"# Changes should be accompanied by documentation explaining what the# new level means in api_docs/changelog.md, as well as "**Changes**"# entries in the endpoint's documentation in `zulip.yaml`.-API_FEATURE_LEVEL = 164+API_FEATURE_LEVEL = 165# 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. Bumpdiff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 3afd363a04a..f71507efcc1 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -15061,18 +15061,22 @@ paths:in: querydescription: |The new name of the group.++ **Changes**: Before Zulip 7.0 (feature level 165), this was+ a required field.schema:type: stringexample: marketing team- required: true- name: descriptionin: querydescription: |The new description of the group.++ **Changes**: Before Zulip 7.0 (feature level 165), this was+ a required field.schema:type: stringexample: The marketing team.- required: trueresponses:"200":$ref: "#/components/responses/SimpleSuccess"diff --git a/zerver/tests/test_user_groups.py b/zerver/tests/test_user_groups.pyindex 8499d86536e..ae72234d0bf 100644--- a/zerver/tests/test_user_groups.py+++ b/zerver/tests/test_user_groups.py@@ -283,6 +283,11 @@ class UserGroupAPITestCase(UserGroupTestCase):result = self.client_patch(f"/json/user_groups/{user_group.id}", info={})self.assert_json_error(result, "No new data supplied")+ # Test when only one of name or description is supplied.+ params = {"name": "help team"}+ result = self.client_patch(f"/json/user_groups/{user_group.id}", info=params)+ self.assert_json_success(result)+# Test when invalid user group is suppliedparams = {"name": "help"}result = self.client_patch("/json/user_groups/1111", info=params)diff --git a/zerver/views/user_groups.py b/zerver/views/user_groups.pyindex fb4d5671012..3d76efce5f6 100644--- a/zerver/views/user_groups.py+++ b/zerver/views/user_groups.py@@ -1,4 +1,4 @@-from typing import Sequence+from typing import Optional, Sequencefrom django.http import HttpRequest, HttpResponsefrom django.utils.translation import gettext as _@@ -62,18 +62,18 @@ def edit_user_group(request: HttpRequest,user_profile: UserProfile,user_group_id: int = REQ(json_validator=check_int, path_only=True),- name: str = REQ(default=""),- description: str = REQ(default=""),+ name: Optional[str] = REQ(default=None),+ description: Optional[str] = REQ(default=None),) -> HttpResponse:- if not (name or description):+ if name is None and description is None:raise JsonableError(_("No new data supplied"))user_group = access_user_group_by_id(user_group_id, user_profile)- if name != user_group.name:+ if name is not None and name != user_group.name:do_update_user_group_name(user_group, name, acting_user=user_profile)- if description != user_group.description:+ if description is not None and description != user_group.description:do_update_user_group_description(user_group, description, acting_user=user_profile)return json_success(request)