mirror of https://github.com/zulip/zulip.git
notification_data: Fix incorrect user_group size being used.
Earlier, in 'get_mentioned_user_group_name()' we were using 'get_user_group_direct_member_ids' function which just checks the number of direct members and not the recursive membership of the group. We should instead use 'get_user_group_member_ids' to calculate the correct members count of the user group.
This commit is contained in:
parent
4e5ab739d0
commit
e1ad0e87dd
|
@ -3,7 +3,7 @@ from dataclasses import dataclass
|
|||
from typing import Any, Collection, Dict, List, Optional, Set
|
||||
|
||||
from zerver.lib.mention import MentionData
|
||||
from zerver.lib.user_groups import get_user_group_direct_member_ids
|
||||
from zerver.lib.user_groups import get_user_group_member_ids
|
||||
from zerver.models import UserGroup, UserProfile, UserTopic
|
||||
from zerver.models.scheduled_jobs import NotificationTriggers
|
||||
|
||||
|
@ -344,7 +344,7 @@ def get_mentioned_user_group_name(
|
|||
smallest_user_group_name = None
|
||||
for user_group_id in mentioned_user_group_ids:
|
||||
current_user_group = UserGroup.objects.get(id=user_group_id, realm=user_profile.realm)
|
||||
current_user_group_size = len(get_user_group_direct_member_ids(current_user_group))
|
||||
current_user_group_size = len(get_user_group_member_ids(current_user_group))
|
||||
|
||||
if current_user_group_size < smallest_user_group_size:
|
||||
# If multiple user groups are mentioned, we prefer the
|
||||
|
|
Loading…
Reference in New Issue