user_groups: Add 'is_system_group' field to objects passed to clients.

This commit is contained in:
Sahil Batra 2021-08-06 23:01:00 +05:30 committed by Tim Abbott
parent 4c290a49d3
commit 5f5c88a4e2
7 changed files with 28 additions and 1 deletions

View File

@ -663,6 +663,7 @@ exports.fixtures = {
name: "Mobile",
description: "mobile folks",
members: [1],
is_system_group: false,
},
},

View File

@ -11,6 +11,12 @@ below features are supported.
## Changes in Zulip 5.0
**Feature level 93**
* [`POST /register`](/api/register-queue), [`GET /user_groups`](/api/get-user-groups),
[`GET /events`](/api/get-events): Added `is_system_group` field to user group
objects.
**Feature level 92**
* [`GET /messages`](/api/get-messages), [`POST

View File

@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"
# Changes should be accompanied by documentation explaining what the
# new level means in templates/zerver/api/changelog.md, as well as
# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 92
API_FEATURE_LEVEL = 93
# 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

View File

@ -7697,6 +7697,7 @@ def do_send_create_user_group_event(user_group: UserGroup, members: List[UserPro
members=[member.id for member in members],
description=user_group.description,
id=user_group.id,
is_system_group=user_group.is_system_group,
),
)
send_event(user_group.realm, event, active_user_ids(user_group.realm_id))

View File

@ -1606,6 +1606,7 @@ group_type = DictType(
("name", str),
("members", ListType(int)),
("description", str),
("is_system_group", bool),
]
)

View File

@ -40,6 +40,7 @@ def user_groups_in_realm_serialized(realm: Realm) -> List[Dict[str, Any]]:
name=user_group.name,
description=user_group.description,
members=[],
is_system_group=user_group.is_system_group,
)
membership = UserGroupMembership.objects.filter(user_group__realm=realm).values_list(

View File

@ -2526,6 +2526,7 @@ paths:
"members": [12],
"description": "Backend team",
"id": 2,
"is_system_group": false,
},
"id": 0,
}
@ -12418,6 +12419,13 @@ paths:
type: string
description: |
User group name.
is_system_group:
type: boolean
description: |
Whether the user group is a system group which cannot be
modified by users.
**Changes**: New in Zulip 5.0 (feature level 93).
description: |
A list of `user_group` objects, which contain a `description`, a `name`,
their `id` and the list of members of the user group.
@ -12432,12 +12440,14 @@ paths:
"id": 1,
"name": "hamletcharacters",
"members": [3, 4],
"is_system_group": false,
},
{
"description": "Other users",
"id": 2,
"name": "other users",
"members": [1, 2],
"is_system_group": true,
},
],
}
@ -13191,6 +13201,13 @@ components:
type: integer
description: |
The ID of the user group.
is_system_group:
type: boolean
description: |
Whether the user group is a system group which cannot be
directly modified by users.
**Changes**: New in Zulip 5.0 (feature level 93).
Subscriptions:
type: object
additionalProperties: false