Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings: Remove private_message_policy setting.

Vector73121043b6f20d
diff --git a/api_docs/changelog.md b/api_docs/changelog.md
index d0c83d0e995..52c8e7e6193 100644
--- a/api_docs/changelog.md
+++ b/api_docs/changelog.md
@@ -31,6 +31,9 @@ format used by the Zulip server that they are interacting with.
[group-setting value](/api/group-setting-values) describing the
set of users of which at least one member must be included as sender
or recipient in all personal and group direct messages.
+ Removed `private_message_policy` property, as the permission to send
+ direct messages is now controlled by `direct_message_initiator_group`
+ and `direct_message_permission_group` settings.
**Feature level 269**
diff --git a/web/src/state_data.ts b/web/src/state_data.ts
index 8e1328950b3..89b6e27aac4 100644
--- a/web/src/state_data.ts
+++ b/web/src/state_data.ts
@@ -347,7 +347,6 @@ const realm_schema = z.object({
}),
),
realm_presence_disabled: z.boolean(),
- realm_private_message_policy: z.number(),
realm_push_notifications_enabled: z.boolean(),
realm_push_notifications_enabled_end_timestamp: NOT_TYPED_YET,
realm_require_unique_names: z.boolean(),
diff --git a/zerver/migrations/0552_remove_realm_private_message_policy.py b/zerver/migrations/0552_remove_realm_private_message_policy.py
new file mode 100644
index 00000000000..d431abbba89
--- /dev/null
+++ b/zerver/migrations/0552_remove_realm_private_message_policy.py
@@ -0,0 +1,16 @@
+# Generated by Django 5.0.6 on 2024-06-27 04:46
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("zerver", "0551_alter_realm_direct_message_initiator_group_and_more"),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name="realm",
+ name="private_message_policy",
+ ),
+ ]
diff --git a/zerver/models/realms.py b/zerver/models/realms.py
index 467ce41744f..b4b0daa6c3f 100644
--- a/zerver/models/realms.py
+++ b/zerver/models/realms.py
@@ -157,11 +157,6 @@ class MoveMessagesBetweenStreamsPolicyEnum(IntEnum):
NOBODY = 6
-class PrivateMessagePolicyEnum(IntEnum):
- UNLIMITED = 1
- DISABLED = 2
-
-
class WildcardMentionPolicyEnum(IntEnum):
EVERYONE = 1
MEMBERS = 2
@@ -364,11 +359,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
user_group_edit_policy = models.PositiveSmallIntegerField(default=CommonPolicyEnum.MEMBERS_ONLY)
- private_message_policy = models.PositiveSmallIntegerField(
- default=PrivateMessagePolicyEnum.UNLIMITED
- )
- PRIVATE_MESSAGE_POLICY_TYPES = [field.value for field in PrivateMessagePolicyEnum]
-
# Global policy for who is allowed to use wildcard mentions in
# streams with a large number of subscribers. Anyone can use
# wildcard mentions in small streams regardless of this setting.
@@ -687,7 +677,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
move_messages_between_streams_policy=int,
name=str,
name_changes_disabled=bool,
- private_message_policy=int,
push_notifications_enabled=bool,
require_unique_names=bool,
send_welcome_emails=bool,
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 4a2b1c97658..87415a5f0a5 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -4605,17 +4605,6 @@ paths:
description: |
Whether online presence of other users is shown in this
organization.
- private_message_policy:
- type: integer
- description: |
- [Policy](/api/roles-and-permissions#permission-levels)
- for [who can send direct messages](/help/restrict-direct-messages)
- in this organization.
-
- - 1 = Everyone
- - 2 = Nobody
-
- **Changes**: New in Zulip 3.0 (feature level 1).
require_unique_names:
type: boolean
description: |
@@ -15782,19 +15771,6 @@ paths:
The day of the week when the organization will send
its weekly digest email to inactive users.
- realm_private_message_policy:
- type: integer
- description: |
- Present if `realm` is present in `fetch_event_types`.
-
- [Policy](/api/roles-and-permissions#permission-levels)
- for [who can send direct messages](/help/restrict-direct-messages)
- in this organization.
-
- - 1 = Everyone
- - 2 = Nobody
-
- **Changes**: New in Zulip 3.0 (feature level 1).
realm_direct_message_initiator_group:
allOf:
- description: |
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index aa969ca3dba..4c3bd8939a9 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -3406,7 +3406,6 @@ class RealmPropertyActionTest(BaseAction):
waiting_period_threshold=[1000, 2000],
create_web_public_stream_policy=Realm.CREATE_WEB_PUBLIC_STREAM_POLICY_TYPES,
invite_to_stream_policy=Realm.COMMON_POLICY_TYPES,
- private_message_policy=Realm.PRIVATE_MESSAGE_POLICY_TYPES,
user_group_edit_policy=Realm.COMMON_POLICY_TYPES,
wildcard_mention_policy=Realm.WILDCARD_MENTION_POLICY_TYPES,
bot_creation_policy=Realm.BOT_CREATION_POLICY_TYPES,
diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py
index 4730b53453a..2d9a51664a6 100644
--- a/zerver/tests/test_home.py
+++ b/zerver/tests/test_home.py
@@ -189,7 +189,6 @@ class HomeTest(ZulipTestCase):
"realm_plan_type",
"realm_playgrounds",
"realm_presence_disabled",
- "realm_private_message_policy",
"realm_push_notifications_enabled",
"realm_push_notifications_enabled_end_timestamp",
"realm_require_unique_names",
diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.py
index bf3a7ea190b..3565719a8c7 100644
--- a/zerver/tests/test_realm.py
+++ b/zerver/tests/test_realm.py
@@ -844,7 +844,6 @@ class RealmTest(ZulipTestCase):
waiting_period_threshold=-10,
digest_weekday=10,
user_group_edit_policy=10,
- private_message_policy=10,
message_content_delete_limit_seconds=-10,
wildcard_mention_policy=10,
invite_to_realm_policy=10,
@@ -1556,7 +1555,6 @@ class RealmAPITest(ZulipTestCase):
waiting_period_threshold=[10, 20],
create_web_public_stream_policy=Realm.CREATE_WEB_PUBLIC_STREAM_POLICY_TYPES,
user_group_edit_policy=Realm.COMMON_POLICY_TYPES,
- private_message_policy=Realm.PRIVATE_MESSAGE_POLICY_TYPES,
invite_to_stream_policy=Realm.COMMON_POLICY_TYPES,
wildcard_mention_policy=Realm.WILDCARD_MENTION_POLICY_TYPES,
bot_creation_policy=Realm.BOT_CREATION_POLICY_TYPES,
diff --git a/zerver/views/realm.py b/zerver/views/realm.py
index c4f2534f1e6..60634f0bc46 100644
--- a/zerver/views/realm.py
+++ b/zerver/views/realm.py
@@ -62,7 +62,6 @@ from zerver.models.realms import (
InviteToRealmPolicyEnum,
MoveMessagesBetweenStreamsPolicyEnum,
OrgTypeEnum,
- PrivateMessagePolicyEnum,
WildcardMentionPolicyEnum,
)
from zerver.views.user_settings import check_settings_values
@@ -157,7 +156,6 @@ def update_realm(
Json[MoveMessagesBetweenStreamsPolicyEnum]
] = None,
user_group_edit_policy: Optional[Json[CommonPolicyEnum]] = None,
- private_message_policy: Optional[Json[PrivateMessagePolicyEnum]] = None,
wildcard_mention_policy: Optional[Json[WildcardMentionPolicyEnum]] = None,
video_chat_provider: Optional[Json[int]] = None,
jitsi_server_url_raw: Annotated[