mirror of https://github.com/zulip/zulip.git
user_groups: Add can_mention_group_id field to UserGroup objects.
This commit adds code to include can_mention_group_id field to UserGroup objects passed with response of various endpoints including "/register" endpoint and also in the group object send with user group creation event. Fixes a part of #25927.
This commit is contained in:
parent
7aaf34fd7e
commit
e6accb0ad9
|
@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.
|
|||
|
||||
## Changes in Zulip 8.0
|
||||
|
||||
**Feature level 191**
|
||||
|
||||
* [`GET /events`](/api/get-events), [`POST /register`](/api/register-queue),
|
||||
[`GET /user_groups`](/api/get-user-groups): Add `can_mention_group_id` to
|
||||
user group objects.
|
||||
|
||||
**Feature level 190**
|
||||
|
||||
* [`DELETE /realm/emoji/{emoji_name}`](/api/deactivate-custom-emoji): This endpoint
|
||||
|
|
|
@ -795,6 +795,7 @@ exports.fixtures = {
|
|||
members: [1],
|
||||
is_system_group: false,
|
||||
direct_subgroup_ids: [2],
|
||||
can_mention_group_id: 11,
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ def do_send_create_user_group_event(
|
|||
id=user_group.id,
|
||||
is_system_group=user_group.is_system_group,
|
||||
direct_subgroup_ids=[direct_subgroup.id for direct_subgroup in direct_subgroups],
|
||||
can_mention_group_id=user_group.can_mention_group_id,
|
||||
),
|
||||
)
|
||||
send_event(user_group.realm, event, active_user_ids(user_group.realm_id))
|
||||
|
|
|
@ -1693,6 +1693,7 @@ group_type = DictType(
|
|||
("direct_subgroup_ids", ListType(int)),
|
||||
("description", str),
|
||||
("is_system_group", bool),
|
||||
("can_mention_group_id", int),
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ class UserGroupDict(TypedDict):
|
|||
members: List[int]
|
||||
direct_subgroup_ids: List[int]
|
||||
is_system_group: bool
|
||||
can_mention_group_id: int
|
||||
|
||||
|
||||
def access_user_group_by_id(
|
||||
|
@ -107,6 +108,7 @@ def user_groups_in_realm_serialized(realm: Realm) -> List[UserGroupDict]:
|
|||
members=[],
|
||||
direct_subgroup_ids=[],
|
||||
is_system_group=user_group.is_system_group,
|
||||
can_mention_group_id=user_group.can_mention_group_id,
|
||||
)
|
||||
|
||||
membership = UserGroupMembership.objects.filter(user_group__realm=realm).values_list(
|
||||
|
|
|
@ -2906,6 +2906,7 @@ paths:
|
|||
"description": "Backend team",
|
||||
"id": 2,
|
||||
"is_system_group": false,
|
||||
"can_mention_group_id": 11,
|
||||
},
|
||||
"id": 0,
|
||||
}
|
||||
|
@ -16401,6 +16402,13 @@ paths:
|
|||
modified by users.
|
||||
|
||||
**Changes**: New in Zulip 5.0 (feature level 93).
|
||||
can_mention_group_id:
|
||||
type: integer
|
||||
description: |
|
||||
ID of the user group whose members are allowed to mention the group.
|
||||
|
||||
**Changes**: New in Zulip 8.0 (feature level 191). Previously, groups
|
||||
could be mentioned if and only if they were not system groups.
|
||||
description: |
|
||||
A list of `user_group` objects.
|
||||
example:
|
||||
|
@ -16416,6 +16424,7 @@ paths:
|
|||
"members": [1],
|
||||
"direct_subgroup_ids": [],
|
||||
"is_system_group": true,
|
||||
"can_mention_group_id": 11,
|
||||
},
|
||||
{
|
||||
"description": "Administrators of this organization, including owners",
|
||||
|
@ -16424,6 +16433,7 @@ paths:
|
|||
"members": [2],
|
||||
"direct_subgroup_ids": [1],
|
||||
"is_system_group": true,
|
||||
"can_mention_group_id": 12,
|
||||
},
|
||||
{
|
||||
"description": "Characters of Hamlet",
|
||||
|
@ -16432,6 +16442,7 @@ paths:
|
|||
"members": [3, 4],
|
||||
"direct_subgroup_ids": [],
|
||||
"is_system_group": false,
|
||||
"can_mention_group_id": 13,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
@ -17399,6 +17410,13 @@ components:
|
|||
directly modified by users.
|
||||
|
||||
**Changes**: New in Zulip 5.0 (feature level 93).
|
||||
can_mention_group_id:
|
||||
type: integer
|
||||
description: |
|
||||
ID of the user group whose members are allowed to mention the group.
|
||||
|
||||
**Changes**: New in Zulip 8.0 (feature level 191). Previously, groups
|
||||
could be mentioned if and only if they were not system groups.
|
||||
Subscriptions:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
|
|
Loading…
Reference in New Issue