settings: Remove private_message_policy setting.

Removes `private_message_policy` field from both the API and
the backend.
This commit is contained in:
Vector73 2024-07-08 22:30:19 +05:30 committed by Tim Abbott
parent 6098c2cebe
commit 121043b6f2
9 changed files with 19 additions and 42 deletions

View File

@ -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**

View File

@ -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(),

View File

@ -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",
),
]

View File

@ -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,

View File

@ -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: |

View File

@ -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,

View File

@ -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",

View File

@ -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,

View File

@ -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[