Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
realm: Add enums for setting values.
Sahil Batra5d3a0ce94a75
diff --git a/zerver/models/realms.py b/zerver/models/realms.pyindex b9de2250c54..dfb3fac9320 100644--- a/zerver/models/realms.py+++ b/zerver/models/realms.py@@ -1,5 +1,5 @@from email.headerregistry import Address-from enum import Enum+from enum import Enum, IntEnumfrom typing import TYPE_CHECKING, Dict, List, Optional, Tuple, TypedDict, Unionfrom uuid import uuid4@@ -100,6 +100,88 @@ class OrgTypeDict(TypedDict):onboarding_zulip_guide_url: Optional[str]+class CommonPolicyEnum(IntEnum):+ MEMBERS_ONLY = 1+ ADMINS_ONLY = 2+ FULL_MEMBERS_ONLY = 3+ MODERATORS_ONLY = 4+++class CommonMessagePolicyEnum(IntEnum):+ MEMBERS_ONLY = 1+ ADMINS_ONLY = 2+ FULL_MEMBERS_ONLY = 3+ MODERATORS_ONLY = 4+ EVERYONE = 5+++class EditTopicPolicyEnum(IntEnum):+ MEMBERS_ONLY = 1+ ADMINS_ONLY = 2+ FULL_MEMBERS_ONLY = 3+ MODERATORS_ONLY = 4+ EVERYONE = 5+ NOBODY = 6+++class InviteToRealmPolicyEnum(IntEnum):+ MEMBERS_ONLY = 1+ ADMINS_ONLY = 2+ FULL_MEMBERS_ONLY = 3+ MODERATORS_ONLY = 4+ NOBODY = 6+++class CreateWebPublicStreamPolicyEnum(IntEnum):+ # We don't allow granting roles less than Moderator access to+ # create web-public streams, since it's a sensitive feature that+ # can be used to send spam.+ ADMINS_ONLY = 2+ MODERATORS_ONLY = 4+ NOBODY = 6+ OWNERS_ONLY = 7+++class BotCreationPolicyEnum(IntEnum):+ # This value is also being used in web/src/settings_bots.bot_creation_policy_values.+ # On updating it here, update it there as well.+ EVERYONE = 1+ LIMIT_GENERIC_BOTS = 2+ ADMINS_ONLY = 3+++class MoveMessagesBetweenStreamsPolicyEnum(IntEnum):+ MEMBERS_ONLY = 1+ ADMINS_ONLY = 2+ FULL_MEMBERS_ONLY = 3+ MODERATORS_ONLY = 4+ NOBODY = 6+++class PrivateMessagePolicyEnum(IntEnum):+ UNLIMITED = 1+ DISABLED = 2+++class WildcardMentionPolicyEnum(IntEnum):+ EVERYONE = 1+ MEMBERS = 2+ FULL_MEMBERS = 3+ ADMINS = 5+ NOBODY = 6+ MODERATORS = 7+++class DigestWeekdayEnum(IntEnum):+ MONDAY = 0+ TUESDAY = 1+ WEDNESDAY = 2+ THURSDAY = 3+ FRIDAY = 4+ SATURDAY = 5+ SUNDAY = 6++class Realm(models.Model): # type: ignore[django-manager-missing] # django-stubs cannot resolve the custom CTEManager yet https://github.com/typeddjango/django-stubs/issues/1023MAX_REALM_NAME_LENGTH = 40MAX_REALM_DESCRIPTION_LENGTH = 1000