Add limit on chat filter length.
GitOrigin-RevId: 33e627f9792acc429500dd3bdecce6fb4c50e4c4
This commit is contained in:
parent
2b699a213f
commit
1eb7663769
@ -650,7 +650,7 @@ chatTypeSecret secret_chat_id:int32 user_id:int32 = ChatType;
|
|||||||
|
|
||||||
|
|
||||||
//@description Represents a filter of user chats
|
//@description Represents a filter of user chats
|
||||||
//@title The title of the filter
|
//@title The title of the filter; 1-12 characters without line feeds
|
||||||
//@emoji The emoji for short filter representation
|
//@emoji The emoji for short filter representation
|
||||||
//@pinned_chat_ids The chat identifiers of pinned chats in the filtered chat list
|
//@pinned_chat_ids The chat identifiers of pinned chats in the filtered chat list
|
||||||
//@included_chat_ids The chat identifiers of always included chats in the filtered chat list
|
//@included_chat_ids The chat identifiers of always included chats in the filtered chat list
|
||||||
@ -667,7 +667,7 @@ chatFilter title:string emoji:string pinned_chat_ids:vector<int53> included_chat
|
|||||||
|
|
||||||
//@description Contains basic information about a chat filter
|
//@description Contains basic information about a chat filter
|
||||||
//@id Unique chat filter identifier
|
//@id Unique chat filter identifier
|
||||||
//@title The title of the filter
|
//@title The title of the filter; 1-12 characters without line feeds
|
||||||
//@emoji The emoji for short filter representation
|
//@emoji The emoji for short filter representation
|
||||||
chatFilterInfo id:int32 title:string emoji:string = ChatFilterInfo;
|
chatFilterInfo id:int32 title:string emoji:string = ChatFilterInfo;
|
||||||
|
|
||||||
|
@ -15154,7 +15154,10 @@ Result<unique_ptr<MessagesManager::DialogFilter>> MessagesManager::create_dialog
|
|||||||
return Status::Error(400, "Too much pinned chats");
|
return Status::Error(400, "Too much pinned chats");
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_filter->title = std::move(filter->title_);
|
dialog_filter->title = clean_name(std::move(filter->title_), MAX_DIALOG_FILTER_TITLE_LENGTH);
|
||||||
|
if (dialog_filter->title.empty()) {
|
||||||
|
return Status::Error(400, "Title must not be empty");
|
||||||
|
}
|
||||||
dialog_filter->emoji = std::move(filter->emoji_);
|
dialog_filter->emoji = std::move(filter->emoji_);
|
||||||
dialog_filter->exclude_muted = filter->exclude_muted_;
|
dialog_filter->exclude_muted = filter->exclude_muted_;
|
||||||
dialog_filter->exclude_read = filter->exclude_read_;
|
dialog_filter->exclude_read = filter->exclude_read_;
|
||||||
|
@ -1520,6 +1520,7 @@ class MessagesManager : public Actor {
|
|||||||
static constexpr int32 MAX_RECENT_FOUND_DIALOGS = 20; // some reasonable value
|
static constexpr int32 MAX_RECENT_FOUND_DIALOGS = 20; // some reasonable value
|
||||||
static constexpr size_t MAX_TITLE_LENGTH = 128; // server side limit for chat title
|
static constexpr size_t MAX_TITLE_LENGTH = 128; // server side limit for chat title
|
||||||
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server side limit for chat description
|
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server side limit for chat description
|
||||||
|
static constexpr size_t MAX_DIALOG_FILTER_TITLE_LENGTH = 12; // server side limit for dialog filter title
|
||||||
static constexpr int64 SPONSORED_DIALOG_ORDER = static_cast<int64>(2147483647) << 32;
|
static constexpr int64 SPONSORED_DIALOG_ORDER = static_cast<int64>(2147483647) << 32;
|
||||||
static constexpr int32 MIN_PINNED_DIALOG_DATE = 2147000000; // some big date
|
static constexpr int32 MIN_PINNED_DIALOG_DATE = 2147000000; // some big date
|
||||||
static constexpr int32 MAX_PRIVATE_MESSAGE_TTL = 60; // server side limit
|
static constexpr int32 MAX_PRIVATE_MESSAGE_TTL = 60; // server side limit
|
||||||
|
Loading…
Reference in New Issue
Block a user