settings: Remove `add_custom_emoji_policy` setting.

Removed `add_custom_emoji_policy` setting as the permission to
add custom emoji is now controlled by `can_add_custom_emoji_group`
setting.
This commit is contained in:
Vector73 2024-10-13 12:39:26 +05:30 committed by Tim Abbott
parent f733ab112c
commit 6bc8651d22
9 changed files with 19 additions and 35 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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