diff --git a/api_docs/changelog.md b/api_docs/changelog.md index cbac911dd3..f6d9cc02e8 100644 --- a/api_docs/changelog.md +++ b/api_docs/changelog.md @@ -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 diff --git a/web/tests/lib/events.js b/web/tests/lib/events.js index f592217bd1..9fba365822 100644 --- a/web/tests/lib/events.js +++ b/web/tests/lib/events.js @@ -795,6 +795,7 @@ exports.fixtures = { members: [1], is_system_group: false, direct_subgroup_ids: [2], + can_mention_group_id: 11, }, }, diff --git a/zerver/actions/user_groups.py b/zerver/actions/user_groups.py index 6fc9ca9c68..7d8b378143 100644 --- a/zerver/actions/user_groups.py +++ b/zerver/actions/user_groups.py @@ -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)) diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.py index 218867c824..232c3fae9c 100644 --- a/zerver/lib/event_schema.py +++ b/zerver/lib/event_schema.py @@ -1693,6 +1693,7 @@ group_type = DictType( ("direct_subgroup_ids", ListType(int)), ("description", str), ("is_system_group", bool), + ("can_mention_group_id", int), ] ) diff --git a/zerver/lib/user_groups.py b/zerver/lib/user_groups.py index b70931c344..cdeb0b4c97 100644 --- a/zerver/lib/user_groups.py +++ b/zerver/lib/user_groups.py @@ -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( diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index 50f27837a2..5cea26d44c 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -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