mirror of https://github.com/zulip/zulip.git
settings: Add moderators option for wildcard_mention_policy.
This commit is contained in:
parent
141232749b
commit
6e672ebbee
|
@ -10,6 +10,10 @@ below features are supported.
|
||||||
|
|
||||||
## Changes in Zulip 4.0
|
## Changes in Zulip 4.0
|
||||||
|
|
||||||
|
**Feature level 62**
|
||||||
|
|
||||||
|
* Added `moderators only` option for `wildcard_mention_policy`.
|
||||||
|
|
||||||
**Feature level 61**
|
**Feature level 61**
|
||||||
|
|
||||||
* Added support for inviting users as moderators to the invitation
|
* Added support for inviting users as moderators to the invitation
|
||||||
|
|
|
@ -30,7 +30,7 @@ DESKTOP_WARNING_VERSION = "5.2.0"
|
||||||
#
|
#
|
||||||
# Changes should be accompanied by documentation explaining what the
|
# Changes should be accompanied by documentation explaining what the
|
||||||
# new level means in templates/zerver/api/changelog.md.
|
# new level means in templates/zerver/api/changelog.md.
|
||||||
API_FEATURE_LEVEL = 61
|
API_FEATURE_LEVEL = 62
|
||||||
|
|
||||||
# Bump the minor PROVISION_VERSION to indicate that folks should provision
|
# 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
|
# only when going from an old version of the code to a newer version. Bump
|
||||||
|
|
|
@ -1398,6 +1398,9 @@ def wildcard_mention_allowed(sender: UserProfile, stream: Stream) -> bool:
|
||||||
if realm.wildcard_mention_policy == Realm.WILDCARD_MENTION_POLICY_ADMINS:
|
if realm.wildcard_mention_policy == Realm.WILDCARD_MENTION_POLICY_ADMINS:
|
||||||
return sender.is_realm_admin
|
return sender.is_realm_admin
|
||||||
|
|
||||||
|
if realm.wildcard_mention_policy == Realm.WILDCARD_MENTION_POLICY_MODERATORS:
|
||||||
|
return sender.is_realm_admin or sender.is_moderator
|
||||||
|
|
||||||
if realm.wildcard_mention_policy == Realm.WILDCARD_MENTION_POLICY_STREAM_ADMINS:
|
if realm.wildcard_mention_policy == Realm.WILDCARD_MENTION_POLICY_STREAM_ADMINS:
|
||||||
# TODO: Change this when we implement stream administrators
|
# TODO: Change this when we implement stream administrators
|
||||||
return sender.is_realm_admin
|
return sender.is_realm_admin
|
||||||
|
|
|
@ -305,6 +305,7 @@ class Realm(models.Model):
|
||||||
WILDCARD_MENTION_POLICY_STREAM_ADMINS = 4
|
WILDCARD_MENTION_POLICY_STREAM_ADMINS = 4
|
||||||
WILDCARD_MENTION_POLICY_ADMINS = 5
|
WILDCARD_MENTION_POLICY_ADMINS = 5
|
||||||
WILDCARD_MENTION_POLICY_NOBODY = 6
|
WILDCARD_MENTION_POLICY_NOBODY = 6
|
||||||
|
WILDCARD_MENTION_POLICY_MODERATORS = 7
|
||||||
wildcard_mention_policy: int = models.PositiveSmallIntegerField(
|
wildcard_mention_policy: int = models.PositiveSmallIntegerField(
|
||||||
default=WILDCARD_MENTION_POLICY_STREAM_ADMINS,
|
default=WILDCARD_MENTION_POLICY_STREAM_ADMINS,
|
||||||
)
|
)
|
||||||
|
@ -315,6 +316,7 @@ class Realm(models.Model):
|
||||||
WILDCARD_MENTION_POLICY_STREAM_ADMINS,
|
WILDCARD_MENTION_POLICY_STREAM_ADMINS,
|
||||||
WILDCARD_MENTION_POLICY_ADMINS,
|
WILDCARD_MENTION_POLICY_ADMINS,
|
||||||
WILDCARD_MENTION_POLICY_NOBODY,
|
WILDCARD_MENTION_POLICY_NOBODY,
|
||||||
|
WILDCARD_MENTION_POLICY_MODERATORS,
|
||||||
]
|
]
|
||||||
|
|
||||||
# Who in the organization has access to users' actual email
|
# Who in the organization has access to users' actual email
|
||||||
|
|
|
@ -3257,11 +3257,13 @@ paths:
|
||||||
* 4 => Only stream and organization administrators can use wildcard mentions in large streams.
|
* 4 => Only stream and organization administrators can use wildcard mentions in large streams.
|
||||||
* 5 => Only organization administrators can use wildcard mentions in large streams.
|
* 5 => Only organization administrators can use wildcard mentions in large streams.
|
||||||
* 6 => Nobody can use wildcard mentions in large streams.
|
* 6 => Nobody can use wildcard mentions in large streams.
|
||||||
|
* 7 => Only organization adminstartors and moderators can use wildcard mentions in large streams.
|
||||||
|
|
||||||
All users will receive a warning/reminder when using
|
All users will receive a warning/reminder when using
|
||||||
mentions in large streams, even when permitted to do so.
|
mentions in large streams, even when permitted to do so.
|
||||||
|
|
||||||
**Changes**: New in Zulip 4.0 (feature level 33).
|
**Changes**: New in Zulip 4.0 (feature level 33). Moderators option added in
|
||||||
|
Zulip 4.0 (feature level 62).
|
||||||
default_language:
|
default_language:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
|
@ -8208,11 +8210,13 @@ paths:
|
||||||
* 4 => Only stream and organization administrators can use wildcard mentions in large streams.
|
* 4 => Only stream and organization administrators can use wildcard mentions in large streams.
|
||||||
* 5 => Only organization administrators can use wildcard mentions in large streams.
|
* 5 => Only organization administrators can use wildcard mentions in large streams.
|
||||||
* 6 => Nobody can use wildcard mentions in large streams.
|
* 6 => Nobody can use wildcard mentions in large streams.
|
||||||
|
* 7 => Only organization adminstartors and moderators can use wildcard mentions in large streams.
|
||||||
|
|
||||||
All users will receive a warning/reminder when using
|
All users will receive a warning/reminder when using
|
||||||
mentions in large streams, even when permitted to do so.
|
mentions in large streams, even when permitted to do so.
|
||||||
|
|
||||||
**Changes**: New in Zulip 4.0 (feature level 33).
|
**Changes**: New in Zulip 4.0 (feature level 33). Moderators option added in
|
||||||
|
Zulip 4.0 (feature level 62).
|
||||||
realm_default_language:
|
realm_default_language:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
|
|
|
@ -1979,7 +1979,7 @@ class RealmPropertyActionTest(BaseAction):
|
||||||
invite_to_stream_policy=[4, 3, 2, 1],
|
invite_to_stream_policy=[4, 3, 2, 1],
|
||||||
private_message_policy=[2, 1],
|
private_message_policy=[2, 1],
|
||||||
user_group_edit_policy=[1, 2],
|
user_group_edit_policy=[1, 2],
|
||||||
wildcard_mention_policy=[6, 5, 4, 3, 2, 1],
|
wildcard_mention_policy=[7, 6, 5, 4, 3, 2, 1],
|
||||||
email_address_visibility=[Realm.EMAIL_ADDRESS_VISIBILITY_ADMINS],
|
email_address_visibility=[Realm.EMAIL_ADDRESS_VISIBILITY_ADMINS],
|
||||||
bot_creation_policy=[Realm.BOT_CREATION_EVERYONE],
|
bot_creation_policy=[Realm.BOT_CREATION_EVERYONE],
|
||||||
video_chat_provider=[
|
video_chat_provider=[
|
||||||
|
|
|
@ -1827,6 +1827,16 @@ class StreamMessagesTest(ZulipTestCase):
|
||||||
self.send_and_verify_wildcard_mention_message("cordelia", sub_count=10)
|
self.send_and_verify_wildcard_mention_message("cordelia", sub_count=10)
|
||||||
self.send_and_verify_wildcard_mention_message("iago")
|
self.send_and_verify_wildcard_mention_message("iago")
|
||||||
|
|
||||||
|
do_set_realm_property(
|
||||||
|
realm,
|
||||||
|
"wildcard_mention_policy",
|
||||||
|
Realm.WILDCARD_MENTION_POLICY_MODERATORS,
|
||||||
|
acting_user=None,
|
||||||
|
)
|
||||||
|
self.send_and_verify_wildcard_mention_message("cordelia", test_fails=True)
|
||||||
|
self.send_and_verify_wildcard_mention_message("cordelia", sub_count=10)
|
||||||
|
self.send_and_verify_wildcard_mention_message("shiva")
|
||||||
|
|
||||||
cordelia.date_joined = timezone_now()
|
cordelia.date_joined = timezone_now()
|
||||||
cordelia.save()
|
cordelia.save()
|
||||||
do_set_realm_property(
|
do_set_realm_property(
|
||||||
|
|
|
@ -892,6 +892,7 @@ class RealmAPITest(ZulipTestCase):
|
||||||
Realm.WILDCARD_MENTION_POLICY_STREAM_ADMINS,
|
Realm.WILDCARD_MENTION_POLICY_STREAM_ADMINS,
|
||||||
Realm.WILDCARD_MENTION_POLICY_ADMINS,
|
Realm.WILDCARD_MENTION_POLICY_ADMINS,
|
||||||
Realm.WILDCARD_MENTION_POLICY_NOBODY,
|
Realm.WILDCARD_MENTION_POLICY_NOBODY,
|
||||||
|
Realm.WILDCARD_MENTION_POLICY_MODERATORS,
|
||||||
],
|
],
|
||||||
bot_creation_policy=[1, 2],
|
bot_creation_policy=[1, 2],
|
||||||
email_address_visibility=[
|
email_address_visibility=[
|
||||||
|
|
Loading…
Reference in New Issue