mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 01:16:19 +00:00
streams: Backend changes to support anonymous groups.
can_remove_subscribers_group setting can now be set to anonymous user groups. Co-authored-by: Sahil Batra <sahil@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
005a27a9cf
commit
b6ebf143cc
@@ -45,13 +45,26 @@ from zerver.lib.data_types import (
|
||||
make_checker,
|
||||
)
|
||||
from zerver.lib.topic import ORIG_TOPIC, TOPIC_LINKS, TOPIC_NAME
|
||||
from zerver.lib.types import AnonymousSettingGroupDict
|
||||
from zerver.models import Realm, RealmUserDefault, Stream, UserProfile
|
||||
|
||||
group_setting_type = UnionType(
|
||||
[
|
||||
int,
|
||||
DictType(
|
||||
required_keys=[
|
||||
("direct_members", ListType(int)),
|
||||
("direct_subgroups", ListType(int)),
|
||||
]
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
# These fields are used for "stream" events, and are included in the
|
||||
# larger "subscription" events that also contain personal settings.
|
||||
default_stream_fields = [
|
||||
("is_archived", bool),
|
||||
("can_remove_subscribers_group", int),
|
||||
("can_remove_subscribers_group", group_setting_type),
|
||||
("creator_id", OptionalType(int)),
|
||||
("date_created", int),
|
||||
("description", str),
|
||||
@@ -103,6 +116,12 @@ optional_value_type = UnionType(
|
||||
bool,
|
||||
int,
|
||||
str,
|
||||
DictType(
|
||||
required_keys=[
|
||||
("direct_members", ListType(int)),
|
||||
("direct_subgroups", ListType(int)),
|
||||
]
|
||||
),
|
||||
Equals(None),
|
||||
]
|
||||
)
|
||||
@@ -1046,18 +1065,6 @@ night_logo_data = DictType(
|
||||
]
|
||||
)
|
||||
|
||||
group_setting_type = UnionType(
|
||||
[
|
||||
int,
|
||||
DictType(
|
||||
required_keys=[
|
||||
("direct_members", ListType(int)),
|
||||
("direct_subgroups", ListType(int)),
|
||||
]
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
group_setting_update_data_type = DictType(
|
||||
required_keys=[],
|
||||
optional_keys=[
|
||||
@@ -1442,7 +1449,7 @@ def check_stream_update(
|
||||
assert value in Stream.STREAM_POST_POLICY_TYPES
|
||||
elif prop == "can_remove_subscribers_group":
|
||||
assert extra_keys == set()
|
||||
assert isinstance(value, int)
|
||||
assert isinstance(value, int | AnonymousSettingGroupDict)
|
||||
elif prop == "first_message_id":
|
||||
assert extra_keys == set()
|
||||
assert isinstance(value, int)
|
||||
|
||||
Reference in New Issue
Block a user