mirror of https://github.com/zulip/zulip.git
settings: Add new setting for controlling who can move msgs to stream.
This commit adds a new setting 'move_messages_between_streams_policy` for controlling who can move messages from one stream to other.
This commit is contained in:
parent
5f0211285e
commit
2dc99aa90f
|
@ -10,6 +10,12 @@ below features are supported.
|
|||
|
||||
## Changes in Zulip 4.0
|
||||
|
||||
**Feature level 56**
|
||||
|
||||
* [`POST /register`](/api/register-queue): Added a new setting
|
||||
`move_messages_between_streams_policy` for controlling who can
|
||||
move messages between streams.
|
||||
|
||||
**Feature level 55**
|
||||
|
||||
* [`POST /register`](/api/register-queue): Added `realm_giphy_rating`
|
||||
|
|
|
@ -30,7 +30,7 @@ DESKTOP_WARNING_VERSION = "5.2.0"
|
|||
#
|
||||
# Changes should be accompanied by documentation explaining what the
|
||||
# new level means in templates/zerver/api/changelog.md.
|
||||
API_FEATURE_LEVEL = 55
|
||||
API_FEATURE_LEVEL = 56
|
||||
|
||||
# Bump the minor PROVISION_VERSION to indicate that folks should provision
|
||||
# only when going from an old version of the code to a newer version. Bump
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.1.7 on 2021-04-09 14:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("zerver", "0319_realm_giphy_rating"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="realm",
|
||||
name="move_messages_between_streams_policy",
|
||||
field=models.PositiveSmallIntegerField(default=2),
|
||||
),
|
||||
]
|
|
@ -272,6 +272,11 @@ class Realm(models.Model):
|
|||
# Who in the organization is allowed to invite other users to streams.
|
||||
invite_to_stream_policy: int = models.PositiveSmallIntegerField(default=POLICY_MEMBERS_ONLY)
|
||||
|
||||
# Who in the organization is allowed to move messages between streams.
|
||||
move_messages_between_streams_policy: int = models.PositiveSmallIntegerField(
|
||||
default=POLICY_ADMINS_ONLY
|
||||
)
|
||||
|
||||
USER_GROUP_EDIT_POLICY_MEMBERS = 1
|
||||
USER_GROUP_EDIT_POLICY_ADMINS = 2
|
||||
user_group_edit_policy: int = models.PositiveSmallIntegerField(
|
||||
|
@ -492,6 +497,7 @@ class Realm(models.Model):
|
|||
bot_creation_policy=int,
|
||||
create_stream_policy=int,
|
||||
invite_to_stream_policy=int,
|
||||
move_messages_between_streams_policy=int,
|
||||
default_language=str,
|
||||
default_twenty_four_hour_time=bool,
|
||||
description=str,
|
||||
|
|
|
@ -3024,6 +3024,17 @@ paths:
|
|||
description: |
|
||||
The policy for which users can add other users to streams in this
|
||||
organization.
|
||||
move_messages_between_streams_policy:
|
||||
type: integer
|
||||
description: |
|
||||
The policy for which users can move messages from one stream to another.
|
||||
|
||||
* 1 = Members only
|
||||
* 2 = Administrators only
|
||||
* 3 = Full members only
|
||||
* 4 = Moderators only
|
||||
|
||||
**Changes**: New in Zulip 4.0 (feature level 56)
|
||||
wildcard_mention_policy:
|
||||
type: integer
|
||||
description: |
|
||||
|
@ -7960,6 +7971,19 @@ paths:
|
|||
|
||||
**Changes**: New in Zulip 4.0 (feature level 50) replacing the
|
||||
previous `realm_invite_by_admins_only` boolean.
|
||||
realm_move_messages_between_streams_policy:
|
||||
type: integer
|
||||
description: |
|
||||
Present if `realm` is present in `fetch_event_types`.
|
||||
|
||||
The policy for which users can move messages from one stream to another.
|
||||
|
||||
* 1 = Members only
|
||||
* 2 = Administrators only
|
||||
* 3 = Full members only
|
||||
* 4 = Moderators only
|
||||
|
||||
**Changes**: New in Zulip 4.0 (feature level 56)
|
||||
realm_inline_image_preview:
|
||||
type: boolean
|
||||
description: |
|
||||
|
|
|
@ -1899,6 +1899,7 @@ class RealmPropertyActionTest(BaseAction):
|
|||
default_code_block_language=["python", "javascript"],
|
||||
message_content_delete_limit_seconds=[1000, 1100, 1200],
|
||||
invite_to_realm_policy=[4, 3, 2, 1],
|
||||
move_messages_between_streams_policy=[4, 3, 2, 1],
|
||||
)
|
||||
|
||||
vals = test_values.get(name)
|
||||
|
|
|
@ -177,6 +177,7 @@ class HomeTest(ZulipTestCase):
|
|||
"realm_message_content_delete_limit_seconds",
|
||||
"realm_message_content_edit_limit_seconds",
|
||||
"realm_message_retention_days",
|
||||
"realm_move_messages_between_streams_policy",
|
||||
"realm_name",
|
||||
"realm_name_changes_disabled",
|
||||
"realm_name_in_notifications",
|
||||
|
|
|
@ -563,6 +563,20 @@ class RealmTest(ZulipTestCase):
|
|||
result = self.client_patch("/json/realm", req)
|
||||
self.assert_json_error(result, "Invalid invite_to_realm_policy")
|
||||
|
||||
def test_change_move_messages_between_streams_policy(self) -> None:
|
||||
# We need an admin user.
|
||||
self.login("iago")
|
||||
req = dict(
|
||||
move_messages_between_streams_policy=orjson.dumps(Realm.POLICY_ADMINS_ONLY).decode()
|
||||
)
|
||||
result = self.client_patch("/json/realm", req)
|
||||
self.assert_json_success(result)
|
||||
|
||||
invalid_value = 10
|
||||
req = dict(move_messages_between_streams_policy=orjson.dumps(invalid_value).decode())
|
||||
result = self.client_patch("/json/realm", req)
|
||||
self.assert_json_error(result, "Invalid move_messages_between_streams_policy")
|
||||
|
||||
def test_user_group_edit_policy(self) -> None:
|
||||
# We need an admin user.
|
||||
self.login("iago")
|
||||
|
@ -624,6 +638,7 @@ class RealmTest(ZulipTestCase):
|
|||
message_content_delete_limit_seconds=-10,
|
||||
wildcard_mention_policy=10,
|
||||
invite_to_realm_policy=10,
|
||||
move_messages_between_streams_policy=10,
|
||||
)
|
||||
|
||||
# We need an admin user.
|
||||
|
@ -902,6 +917,12 @@ class RealmAPITest(ZulipTestCase):
|
|||
Realm.POLICY_FULL_MEMBERS_ONLY,
|
||||
Realm.POLICY_MODERATORS_ONLY,
|
||||
],
|
||||
move_messages_between_streams_policy=[
|
||||
Realm.POLICY_ADMINS_ONLY,
|
||||
Realm.POLICY_MEMBERS_ONLY,
|
||||
Realm.POLICY_FULL_MEMBERS_ONLY,
|
||||
Realm.POLICY_MODERATORS_ONLY,
|
||||
],
|
||||
)
|
||||
|
||||
vals = test_values.get(name)
|
||||
|
|
|
@ -96,6 +96,9 @@ def update_realm(
|
|||
invite_to_stream_policy: Optional[int] = REQ(
|
||||
json_validator=check_int_in(Realm.COMMON_POLICY_TYPES), default=None
|
||||
),
|
||||
move_messages_between_streams_policy: Optional[int] = REQ(
|
||||
json_validator=check_int_in(Realm.COMMON_POLICY_TYPES), default=None
|
||||
),
|
||||
user_group_edit_policy: Optional[int] = REQ(
|
||||
json_validator=check_int_in(Realm.USER_GROUP_EDIT_POLICY_TYPES), default=None
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue