api: Add max_message_length field to API data.

Commit 4a3ad0d introduced some extra stream-level parameters
to the `realm` object. This commit extends that to add a
max_message_length paramter too in the same server_level.
This commit is contained in:
Zeeshan Equbal 2021-04-13 04:33:31 +05:30 committed by GitHub
parent fb3bfce513
commit 2da4443cc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 1 deletions

View File

@ -13,7 +13,7 @@ below features are supported.
**Feature level 53** **Feature level 53**
* [`POST /register`](/api/register-queue): Added `max_topic_length` * [`POST /register`](/api/register-queue): Added `max_topic_length`
and renamed `max_stream_name_length` and and `max_message_length`, and renamed `max_stream_name_length` and
`max_stream_description_length` to allow clients to transparently `max_stream_description_length` to allow clients to transparently
support these values changing in a future server version. support these values changing in a future server version.

View File

@ -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.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.lib.users import get_cross_realm_dicts, get_raw_user_data, is_administrator_role
from zerver.models import ( from zerver.models import (
MAX_MESSAGE_LENGTH,
MAX_TOPIC_NAME_LENGTH, MAX_TOPIC_NAME_LENGTH,
Client, Client,
CustomProfileField, CustomProfileField,
@ -254,6 +255,7 @@ def fetch_initial_state_data(
state["max_stream_name_length"] = Stream.MAX_NAME_LENGTH state["max_stream_name_length"] = Stream.MAX_NAME_LENGTH
state["max_stream_description_length"] = Stream.MAX_DESCRIPTION_LENGTH state["max_stream_description_length"] = Stream.MAX_DESCRIPTION_LENGTH
state["max_topic_length"] = MAX_TOPIC_NAME_LENGTH state["max_topic_length"] = MAX_TOPIC_NAME_LENGTH
state["max_message_length"] = MAX_MESSAGE_LENGTH
if want("realm_domains"): if want("realm_domains"):
state["realm_domains"] = get_realm_domains(realm) state["realm_domains"] = get_realm_domains(realm)

View File

@ -6920,6 +6920,17 @@ paths:
**Changes**: New in Zulip 4.0 (feature level 53). Previously, **Changes**: New in Zulip 4.0 (feature level 53). Previously,
this always had value 60. this always had value 60.
max_message_length:
type: integer
description: |
Present if `realm` is present in `fetch_event_types`.
The maximum allowed length for a message. Clients should use
these properties rather than hardcoding field sizes, as they may
change in a future Zulip release.
**Changes**: New in Zulip 4.0 (feature level 53). Previously,
this always had value 10000.
muted_topics: muted_topics:
type: array type: array
description: | description: |

View File

@ -106,6 +106,7 @@ class HomeTest(ZulipTestCase):
"max_icon_file_size", "max_icon_file_size",
"max_logo_file_size", "max_logo_file_size",
"max_message_id", "max_message_id",
"max_message_length",
"max_stream_description_length", "max_stream_description_length",
"max_stream_name_length", "max_stream_name_length",
"max_topic_length", "max_topic_length",