mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
api: Improve encoding of stream/topic max field lengths.
Previously, you had to request the `stream` event type in order to get the stream-level parameters; this was a bad design in part because the `subscription` event type has similar data and is preferred by most clients. So we move these to the `realm` object. We also add the maximum topic length, as an adjacent parameter. While changing this, we also fix these to better match the names of similar API parameters.
This commit is contained in:
@@ -49,6 +49,7 @@ from zerver.lib.user_mutes import get_user_mutes
|
||||
from zerver.lib.user_status import get_user_info_dict
|
||||
from zerver.lib.users import get_cross_realm_dicts, get_raw_user_data, is_administrator_role
|
||||
from zerver.models import (
|
||||
MAX_TOPIC_NAME_LENGTH,
|
||||
Client,
|
||||
CustomProfileField,
|
||||
Message,
|
||||
@@ -250,6 +251,10 @@ def fetch_initial_state_data(
|
||||
else:
|
||||
state["realm_signup_notifications_stream_id"] = -1
|
||||
|
||||
state["max_stream_name_length"] = Stream.MAX_NAME_LENGTH
|
||||
state["max_stream_description_length"] = Stream.MAX_DESCRIPTION_LENGTH
|
||||
state["max_topic_length"] = MAX_TOPIC_NAME_LENGTH
|
||||
|
||||
if want("realm_domains"):
|
||||
state["realm_domains"] = get_realm_domains(realm)
|
||||
|
||||
@@ -415,8 +420,6 @@ def fetch_initial_state_data(
|
||||
# be used when the mobile apps support logged-out
|
||||
# access.
|
||||
state["streams"] = get_web_public_streams(realm) # nocoverage
|
||||
state["stream_name_max_length"] = Stream.MAX_NAME_LENGTH
|
||||
state["stream_description_max_length"] = Stream.MAX_DESCRIPTION_LENGTH
|
||||
if want("default_streams"):
|
||||
if settings_user.is_guest:
|
||||
# Guest users and logged-out users don't have access to
|
||||
|
||||
Reference in New Issue
Block a user