Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Remove `edit_topic_policy` setting.
Vector731ba1408b0103
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex 3d852599e6b..30a0dbeae50 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -28,6 +28,10 @@ format used by the Zulip server that they are interacting with.[group-setting value](/api/group-setting-values) describing the set of userswith permission to move messages from one topic to another within a channelin the organization.+* `PATCH /realm`, [`GET /events`](/api/get-events): Removed+ `edit_topic_policy` property, as the permission to move messages between+ topics in the organization is now controlled by+ `can_move_messages_between_topics_group` setting.**Feature level 315**diff --git a/zerver/actions/realm_settings.py b/zerver/actions/realm_settings.pyindex babcce70559..7d06ab82577 100644--- a/zerver/actions/realm_settings.py+++ b/zerver/actions/realm_settings.py@@ -82,7 +82,6 @@ def do_set_realm_property(# These settings have a different event format due to their history.message_edit_settings = ["allow_message_editing",- "edit_topic_policy","message_content_edit_limit_seconds",]if name in message_edit_settings:diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.pyindex 046aea37f8f..5d47f3505bd 100644--- a/zerver/lib/event_schema.py+++ b/zerver/lib/event_schema.py@@ -1039,12 +1039,6 @@ message_content_edit_limit_seconds_data = DictType(])-edit_topic_policy_data = DictType(- required_keys=[- ("edit_topic_policy", int),- ]-)-night_logo_data = DictType(required_keys=[("night_logo_url", str),@@ -1096,7 +1090,6 @@ update_dict_data = UnionType([allow_message_editing_data,authentication_data,- edit_topic_policy_data,icon_data,logo_data,message_content_edit_limit_seconds_data,@@ -1131,8 +1124,6 @@ def check_realm_update_dict(sub_type = allow_message_editing_dataelif "message_content_edit_limit_seconds" in event["data"]:sub_type = message_content_edit_limit_seconds_data- elif "edit_topic_policy" in event["data"]:- sub_type = edit_topic_policy_dataelif "authentication_methods" in event["data"]:sub_type = authentication_dataelif any(diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex 8d7b23d4e7f..5d4e2b7be1a 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -96,7 +96,6 @@ from zerver.models.linkifiers import linkifiers_for_realmfrom zerver.models.realm_emoji import get_all_custom_emoji_for_realmfrom zerver.models.realm_playgrounds import get_realm_playgroundsfrom zerver.models.realms import (- EditTopicPolicyEnum,get_corresponding_policy_value_for_group_setting,get_realm_domains,get_realm_with_settings,@@ -332,9 +331,6 @@ def fetch_initial_state_data(state["realm_allow_message_editing"] = (False if user_profile is None else realm.allow_message_editing)- state["realm_edit_topic_policy"] = (- EditTopicPolicyEnum.ADMINS_ONLY if user_profile is None else realm.edit_topic_policy- )# This setting determines whether to send presence and also# whether to display of users list in the right sidebar; wediff --git a/zerver/migrations/0001_squashed_0569.py b/zerver/migrations/0001_squashed_0569.pyindex 346f64db5d3..3c323e9dbcf 100644--- a/zerver/migrations/0001_squashed_0569.py+++ b/zerver/migrations/0001_squashed_0569.py@@ -30,6 +30,15 @@ class LegacyCommonMessagePolicyEnum(IntEnum):EVERYONE = 5+class LegacyEditTopicPolicyEnum(IntEnum):+ MEMBERS_ONLY = 1+ ADMINS_ONLY = 2+ FULL_MEMBERS_ONLY = 3+ MODERATORS_ONLY = 4+ EVERYONE = 5+ NOBODY = 6++def get_fts_sql() -> str:if settings.POSTGRESQL_MISSING_DICTIONARIES:fts_sql = """@@ -743,9 +752,7 @@ class Migration(migrations.Migration):),("edit_topic_policy",- models.PositiveSmallIntegerField(- default=zerver.models.realms.EditTopicPolicyEnum["EVERYONE"]- ),+ models.PositiveSmallIntegerField(default=LegacyEditTopicPolicyEnum["EVERYONE"]),),("invite_to_realm_policy",diff --git a/zerver/migrations/0621_remove_realm_edit_topic_policy.py b/zerver/migrations/0621_remove_realm_edit_topic_policy.pynew file mode 100644index 00000000000..6cc29718cf6--- /dev/null+++ b/zerver/migrations/0621_remove_realm_edit_topic_policy.py@@ -0,0 +1,16 @@+# Generated by Django 5.0.9 on 2024-10-27 16:28++from django.db import migrations+++class Migration(migrations.Migration):+ dependencies = [+ ("zerver", "0620_alter_realm_can_move_messages_between_topics_group"),+ ]++ operations = [+ migrations.RemoveField(+ model_name="realm",+ name="edit_topic_policy",+ ),+ ]diff --git a/zerver/models/realms.py b/zerver/models/realms.pyindex 4d36a452fa3..9b5a0fc4d8b 100644--- a/zerver/models/realms.py+++ b/zerver/models/realms.py@@ -106,15 +106,6 @@ class CommonPolicyEnum(IntEnum):MODERATORS_ONLY = 4-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 = 1ADMINS_ONLY = 2@@ -268,8 +259,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stubfield.value for field in CreateWebPublicStreamPolicyEnum]- EDIT_TOPIC_POLICY_TYPES = [field.value for field in EditTopicPolicyEnum]-DEFAULT_MOVE_MESSAGE_LIMIT_SECONDS = 7 * SECONDS_PER_DAYmove_messages_within_stream_limit_seconds = models.PositiveIntegerField(@@ -311,9 +300,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub"UserGroup", on_delete=models.RESTRICT, related_name="+")- # Who in the organization is allowed to edit topics of any message.- edit_topic_policy = models.PositiveSmallIntegerField(default=EditTopicPolicyEnum.EVERYONE)-# Who in the organization is allowed to invite other users to organization.invite_to_realm_policy = models.PositiveSmallIntegerField(default=InviteToRealmPolicyEnum.MEMBERS_ONLY@@ -654,7 +640,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stubdigest_emails_enabled=bool,digest_weekday=int,disallow_disposable_email_addresses=bool,- edit_topic_policy=int,email_changes_disabled=bool,emails_restricted_to_domains=bool,enable_guest_user_indicator=bool,diff --git a/zerver/models/users.py b/zerver/models/users.pyindex a6806dee565..4efe99a9b1d 100644--- a/zerver/models/users.py+++ b/zerver/models/users.py@@ -817,7 +817,6 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings):from zerver.models import Realmif policy_name not in Realm.REALM_PERMISSION_GROUP_SETTINGS and policy_name not in [- "edit_topic_policy","invite_to_stream_policy","invite_to_realm_policy",]:diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex db526a76922..bc313f43999 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -4357,7 +4357,11 @@ paths:description: |An object containing the properties that have changed.- **Changes**: In Zulip 7.0 (feature level 183), the+ **Changes**: In Zulip 10.0 (feature level 316), `edit_topic_policy`+ property was removed and replaced by `can_move_messages_between_topics_group`+ realm setting.++ In Zulip 7.0 (feature level 183), the`community_topic_editing_limit_seconds` property was removed.It was documented as potentially returned as a changed propertyin this event, but in fact it was only ever returned in the@@ -4633,27 +4637,6 @@ paths:description: |Whether the organization disallows disposable emailaddresses.- edit_topic_policy:- type: integer- description: |- The [policy][permission-level] for which users can edit topics of any message.-- - 1 = Members only- - 2 = Admins only- - 3 = [Full members][calc-full-member] only- - 4 = Moderators only- - 5 = Everyone- - 6 = Nobody-- See [`PATCH /messages/{message_id}`](/api/update-message) for details and history- of how message editing permissions work.-- **Changes**: Nobody added as an option in Zulip 7.0 (feature level 159).-- New in Zulip 5.0 (feature level 75).-- [permission-level]: /api/roles-and-permissions#permission-levels- [calc-full-member]: /api/roles-and-permissions#determining-if-a-user-is-a-full-memberemail_changes_disabled:type: booleandescription: |@@ -16928,29 +16911,6 @@ paths:history of how message editing permissions work.[config-message-editing]: /help/restrict-message-editing-and-deletion- realm_edit_topic_policy:- type: integer- description: |- Present if `realm` is present in `fetch_event_types`.-- The [policy][permission-level] for which users can edit topics of any message.-- - 1 = Members only- - 2 = Admins only- - 3 = [Full members][calc-full-member] only- - 4 = Moderators only- - 5 = Everyone- - 6 = Nobody-- See [`PATCH /messages/{message_id}`](/api/update-message) for details and- history of how message editing permissions work.-- **Changes**: Nobody added as an option in Zulip 7.0 (feature level 159).-- New in Zulip 5.0 (feature level 75).-- [permission-level]: /api/roles-and-permissions#permission-levels- [calc-full-member]: /api/roles-and-permissions#determining-if-a-user-is-a-full-memberrealm_message_content_edit_limit_seconds:type: integernullable: truediff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex c58cc069032..b90eabcb6d9 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -3743,7 +3743,6 @@ class RealmPropertyActionTest(BaseAction):default_code_block_language=["python", "javascript"],message_content_delete_limit_seconds=[1000, 1100, 1200],invite_to_realm_policy=Realm.INVITE_TO_REALM_POLICY_TYPES,- edit_topic_policy=Realm.EDIT_TOPIC_POLICY_TYPES,message_content_edit_limit_seconds=[1000, 1100, 1200, None],move_messages_within_stream_limit_seconds=[1000, 1100, 1200],move_messages_between_streams_limit_seconds=[1000, 1100, 1200],@@ -3804,7 +3803,6 @@ class RealmPropertyActionTest(BaseAction):if name in ["allow_message_editing",- "edit_topic_policy","message_content_edit_limit_seconds",]:check_realm_update_dict("events[0]", events[0])diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.pyindex 15e91e134f5..16313727cc3 100644--- a/zerver/tests/test_home.py+++ b/zerver/tests/test_home.py@@ -156,7 +156,6 @@ class HomeTest(ZulipTestCase):"realm_direct_message_permission_group","realm_disallow_disposable_email_addresses","realm_domains",- "realm_edit_topic_policy","realm_email_auth_enabled","realm_email_changes_disabled","realm_emails_restricted_to_domains",diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.pyindex 6c09c8504fe..dcac8f603ca 100644--- a/zerver/tests/test_realm.py+++ b/zerver/tests/test_realm.py@@ -849,7 +849,6 @@ class RealmTest(ZulipTestCase):message_content_delete_limit_seconds=-10,wildcard_mention_policy=10,invite_to_realm_policy=10,- edit_topic_policy=10,message_content_edit_limit_seconds=0,move_messages_within_stream_limit_seconds=0,move_messages_between_streams_limit_seconds=0,@@ -1697,7 +1696,6 @@ class RealmAPITest(ZulipTestCase):],message_content_delete_limit_seconds=[1000, 1100, 1200],invite_to_realm_policy=Realm.INVITE_TO_REALM_POLICY_TYPES,- edit_topic_policy=Realm.EDIT_TOPIC_POLICY_TYPES,message_content_edit_limit_seconds=[1000, 1100, 1200],move_messages_within_stream_limit_seconds=[1000, 1100, 1200],move_messages_between_streams_limit_seconds=[1000, 1100, 1200],diff --git a/zerver/views/realm.py b/zerver/views/realm.pyindex 397afde2adb..6aa7f5e4edf 100644--- a/zerver/views/realm.py+++ b/zerver/views/realm.py@@ -52,7 +52,6 @@ from zerver.models.realms import (BotCreationPolicyEnum,CommonPolicyEnum,DigestWeekdayEnum,- EditTopicPolicyEnum,InviteToRealmPolicyEnum,OrgTypeEnum,WildcardMentionPolicyEnum,@@ -116,7 +115,6 @@ def update_realm(ApiParamConfig("message_content_delete_limit_seconds"),] = None,allow_message_editing: Json[bool] | None = None,- edit_topic_policy: Json[EditTopicPolicyEnum] | None = None,mandatory_topics: Json[bool] | None = None,message_content_edit_limit_seconds_raw: Annotated[Json[int | str] | None, ApiParamConfig("message_content_edit_limit_seconds")