mirror of https://github.com/zulip/zulip.git
user_groups: Define AnonymousSettingGroupDict in types.py.
AnonymousSettingGroupDict is now defined in types.py instead of user_groups.py to avoid import cycles in future commits.
This commit is contained in:
parent
10ae4ffea4
commit
b78ca79ccf
|
@ -21,10 +21,10 @@ from zerver.lib.send_email import FromAddress, send_email, send_email_to_admins
|
|||
from zerver.lib.sessions import delete_realm_user_sessions
|
||||
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
|
||||
from zerver.lib.timezone import canonicalize_timezone
|
||||
from zerver.lib.types import AnonymousSettingGroupDict
|
||||
from zerver.lib.upload import delete_message_attachments
|
||||
from zerver.lib.user_counts import realm_user_count_by_role
|
||||
from zerver.lib.user_groups import (
|
||||
AnonymousSettingGroupDict,
|
||||
get_group_setting_value_for_api,
|
||||
get_group_setting_value_for_audit_log_data,
|
||||
)
|
||||
|
|
|
@ -9,8 +9,8 @@ from django.utils.translation import gettext as _
|
|||
|
||||
from zerver.lib.exceptions import JsonableError
|
||||
from zerver.lib.timestamp import datetime_to_timestamp
|
||||
from zerver.lib.types import AnonymousSettingGroupDict
|
||||
from zerver.lib.user_groups import (
|
||||
AnonymousSettingGroupDict,
|
||||
get_group_setting_value_for_api,
|
||||
get_group_setting_value_for_audit_log_data,
|
||||
get_role_based_system_groups_dict,
|
||||
|
|
|
@ -29,8 +29,9 @@ from zerver.lib.soft_deactivation import queue_soft_reactivation
|
|||
from zerver.lib.stream_subscription import bulk_get_subscriber_peer_info
|
||||
from zerver.lib.stream_traffic import get_streams_traffic
|
||||
from zerver.lib.streams import get_streams_for_user, stream_to_dict
|
||||
from zerver.lib.types import AnonymousSettingGroupDict
|
||||
from zerver.lib.user_counts import realm_user_count_by_role
|
||||
from zerver.lib.user_groups import AnonymousSettingGroupDict, get_system_user_group_for_user
|
||||
from zerver.lib.user_groups import get_system_user_group_for_user
|
||||
from zerver.lib.users import (
|
||||
get_active_bots_owned_by_user,
|
||||
get_user_ids_who_can_access_user,
|
||||
|
|
|
@ -138,6 +138,12 @@ class UserTopicDict(TypedDict, total=False):
|
|||
visibility_policy: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class AnonymousSettingGroupDict:
|
||||
direct_members: list[int]
|
||||
direct_subgroups: list[int]
|
||||
|
||||
|
||||
# This next batch of types is for Stream/Subscription objects.
|
||||
class RawStreamDict(TypedDict):
|
||||
"""Dictionary containing fields fetched from the Stream model that
|
||||
|
|
|
@ -18,7 +18,11 @@ from zerver.lib.exceptions import (
|
|||
SystemGroupRequiredError,
|
||||
)
|
||||
from zerver.lib.timestamp import datetime_to_timestamp
|
||||
from zerver.lib.types import GroupPermissionSetting, ServerSupportedPermissionSettings
|
||||
from zerver.lib.types import (
|
||||
AnonymousSettingGroupDict,
|
||||
GroupPermissionSetting,
|
||||
ServerSupportedPermissionSettings,
|
||||
)
|
||||
from zerver.models import (
|
||||
GroupGroupMembership,
|
||||
NamedUserGroup,
|
||||
|
@ -33,12 +37,6 @@ from zerver.models.groups import SystemGroups
|
|||
from zerver.models.realm_audit_logs import AuditLogEventType
|
||||
|
||||
|
||||
@dataclass
|
||||
class AnonymousSettingGroupDict:
|
||||
direct_members: list[int]
|
||||
direct_subgroups: list[int]
|
||||
|
||||
|
||||
@dataclass
|
||||
class GroupSettingChangeRequest:
|
||||
new: int | AnonymousSettingGroupDict
|
||||
|
|
|
@ -221,10 +221,9 @@ from zerver.lib.test_helpers import (
|
|||
)
|
||||
from zerver.lib.timestamp import convert_to_UTC, datetime_to_timestamp
|
||||
from zerver.lib.topic import TOPIC_NAME
|
||||
from zerver.lib.types import ProfileDataElementUpdateDict
|
||||
from zerver.lib.types import AnonymousSettingGroupDict, ProfileDataElementUpdateDict
|
||||
from zerver.lib.upload import upload_message_attachment
|
||||
from zerver.lib.user_groups import (
|
||||
AnonymousSettingGroupDict,
|
||||
get_group_setting_value_for_api,
|
||||
get_role_based_system_groups_dict,
|
||||
)
|
||||
|
|
|
@ -35,8 +35,8 @@ from zerver.lib.streams import ensure_stream
|
|||
from zerver.lib.test_classes import ZulipTestCase
|
||||
from zerver.lib.test_helpers import most_recent_usermessage
|
||||
from zerver.lib.timestamp import datetime_to_timestamp
|
||||
from zerver.lib.types import AnonymousSettingGroupDict
|
||||
from zerver.lib.user_groups import (
|
||||
AnonymousSettingGroupDict,
|
||||
get_direct_user_groups,
|
||||
get_recursive_group_members,
|
||||
get_recursive_membership_groups,
|
||||
|
|
|
@ -22,8 +22,8 @@ from zerver.lib.exceptions import JsonableError
|
|||
from zerver.lib.mention import MentionBackend, silent_mention_syntax_for_user
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.typed_endpoint import PathOnly, typed_endpoint
|
||||
from zerver.lib.types import AnonymousSettingGroupDict
|
||||
from zerver.lib.user_groups import (
|
||||
AnonymousSettingGroupDict,
|
||||
GroupSettingChangeRequest,
|
||||
access_user_group_for_deactivation,
|
||||
access_user_group_for_setting,
|
||||
|
|
Loading…
Reference in New Issue