mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
mention_dataset: Add query to mention cross realm bots as pill.
Previously, cross realm bots were not displayed as mention Pills. This is because, the data set for validating mentions considers only the realm id which is None in case of cross realm bots. Hence, adding an or Q object to it, to also check if the email is a part of the cross realm bots email, in case the realm id returns None. Fixes #26913
This commit is contained in:
@@ -3,6 +3,7 @@ import re
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Dict, List, Match, Optional, Set, Tuple
|
from typing import Dict, List, Match, Optional, Set, Tuple
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from zerver.models import UserGroup, UserProfile, get_linkable_streams
|
from zerver.models import UserGroup, UserProfile, get_linkable_streams
|
||||||
@@ -91,9 +92,9 @@ class MentionBackend:
|
|||||||
|
|
||||||
rows = (
|
rows = (
|
||||||
UserProfile.objects.filter(
|
UserProfile.objects.filter(
|
||||||
realm_id=self.realm_id,
|
Q(realm_id=self.realm_id) | Q(email__in=settings.CROSS_REALM_BOT_EMAILS),
|
||||||
is_active=True,
|
|
||||||
)
|
)
|
||||||
|
.filter(is_active=True)
|
||||||
.filter(
|
.filter(
|
||||||
functools.reduce(lambda a, b: a | b, q_list),
|
functools.reduce(lambda a, b: a | b, q_list),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user