diff --git a/api_docs/changelog.md b/api_docs/changelog.md index ecc2615b75..01c655132e 100644 --- a/api_docs/changelog.md +++ b/api_docs/changelog.md @@ -27,6 +27,9 @@ format used by the Zulip server that they are interacting with. Added `can_add_custom_emoji_group` realm setting which is a [group-setting value](/api/group-setting-values) describing the set of users with permission to add custom emoji in the organization. +* `PATCH /realm`, [`GET /events`](/api/get-events): Removed + `add_custom_emoji_policy` property, as the permission to add custom emoji + in the organization is now controlled by `can_add_custom_emoji_group` setting. **Feature level 306** diff --git a/zerver/migrations/0606_remove_realm_add_custom_emoji_policy.py b/zerver/migrations/0606_remove_realm_add_custom_emoji_policy.py new file mode 100644 index 0000000000..2fa790fef3 --- /dev/null +++ b/zerver/migrations/0606_remove_realm_add_custom_emoji_policy.py @@ -0,0 +1,16 @@ +# Generated by Django 5.0.9 on 2024-10-05 04:45 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("zerver", "0605_alter_realm_can_add_custom_emoji_group"), + ] + + operations = [ + migrations.RemoveField( + model_name="realm", + name="add_custom_emoji_policy", + ), + ] diff --git a/zerver/models/realms.py b/zerver/models/realms.py index 9456fe22ed..1ba3103291 100644 --- a/zerver/models/realms.py +++ b/zerver/models/realms.py @@ -282,11 +282,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub default=DEFAULT_MOVE_MESSAGE_LIMIT_SECONDS, null=True ) - # Who in the organization is allowed to add custom emojis. - add_custom_emoji_policy = models.PositiveSmallIntegerField( - default=CommonPolicyEnum.MEMBERS_ONLY - ) - # Who in the organization is allowed to add custom emojis. can_add_custom_emoji_group = models.ForeignKey( "UserGroup", on_delete=models.RESTRICT, related_name="+" @@ -646,7 +641,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub # Define the types of the various automatically managed properties property_types: dict[str, type | tuple[type, ...]] = dict( - add_custom_emoji_policy=int, allow_edit_history=bool, allow_message_editing=bool, avatar_changes_disabled=bool, diff --git a/zerver/models/users.py b/zerver/models/users.py index 57e5fa53e6..9c123d06ee 100644 --- a/zerver/models/users.py +++ b/zerver/models/users.py @@ -815,7 +815,6 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings): from zerver.models import Realm if policy_name not in [ - "add_custom_emoji_policy", "can_add_custom_emoji_group", "can_create_groups", "can_create_private_channel_group", diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index b3c048a73f..bf2f3522cd 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -4313,11 +4313,6 @@ paths: irrespective of which of these settings were changed. Now, a separate event is sent for each changed setting. properties: - add_custom_emoji_policy: - type: integer - description: | - The [policy](/api/roles-and-permissions#permission-levels) - for which users can add custom emoji in this organization. allow_edit_history: type: boolean description: | @@ -16224,24 +16219,6 @@ paths: type: string description: | The text describing the emoji set. - realm_add_custom_emoji_policy: - type: integer - description: | - Present if `realm` is present in `fetch_event_types`. - - The [policy][permission-level] for which users can upload new custom emoji - in this organization. - - - 1 = Members only - - 2 = Administrators only - - 3 = [Full members][calc-full-member] only - - 4 = Moderators only - - **Changes**: New in Zulip 5.0 (feature level 85) replacing the - previous `realm_add_emoji_by_admins_only` boolean. - - [permission-level]: /api/roles-and-permissions#permission-levels - [calc-full-member]: /api/roles-and-permissions#determining-if-a-user-is-a-full-member realm_allow_edit_history: type: boolean description: | diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py index 5ab41b62b4..632c0640e7 100644 --- a/zerver/tests/test_events.py +++ b/zerver/tests/test_events.py @@ -3715,7 +3715,6 @@ class RealmPropertyActionTest(BaseAction): message_content_delete_limit_seconds=[1000, 1100, 1200], invite_to_realm_policy=Realm.INVITE_TO_REALM_POLICY_TYPES, move_messages_between_streams_policy=Realm.MOVE_MESSAGES_BETWEEN_STREAMS_POLICY_TYPES, - add_custom_emoji_policy=Realm.COMMON_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], diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py index 9e88da5098..6abd363765 100644 --- a/zerver/tests/test_home.py +++ b/zerver/tests/test_home.py @@ -120,7 +120,6 @@ class HomeTest(ZulipTestCase): "presences", "presence_last_update_id", "queue_id", - "realm_add_custom_emoji_policy", "realm_allow_edit_history", "realm_allow_message_editing", "realm_authentication_methods", diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.py index 4fc4c3245e..5c3f1eb1b9 100644 --- a/zerver/tests/test_realm.py +++ b/zerver/tests/test_realm.py @@ -862,7 +862,6 @@ class RealmTest(ZulipTestCase): wildcard_mention_policy=10, invite_to_realm_policy=10, move_messages_between_streams_policy=10, - add_custom_emoji_policy=10, edit_topic_policy=10, message_content_edit_limit_seconds=0, move_messages_within_stream_limit_seconds=0, @@ -1712,7 +1711,6 @@ class RealmAPITest(ZulipTestCase): message_content_delete_limit_seconds=[1000, 1100, 1200], invite_to_realm_policy=Realm.INVITE_TO_REALM_POLICY_TYPES, move_messages_between_streams_policy=Realm.MOVE_MESSAGES_BETWEEN_STREAMS_POLICY_TYPES, - add_custom_emoji_policy=Realm.COMMON_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], diff --git a/zerver/views/realm.py b/zerver/views/realm.py index 05a9a37dc6..7872260e7c 100644 --- a/zerver/views/realm.py +++ b/zerver/views/realm.py @@ -111,7 +111,6 @@ def update_realm( avatar_changes_disabled: Json[bool] | None = None, inline_image_preview: Json[bool] | None = None, inline_url_embed_preview: Json[bool] | None = None, - add_custom_emoji_policy: Json[CommonPolicyEnum] | None = None, can_add_custom_emoji_group: Json[GroupSettingChangeRequest] | None = None, can_delete_any_message_group: Json[GroupSettingChangeRequest] | None = None, can_delete_own_message_group: Json[GroupSettingChangeRequest] | None = None,