Add search text for topic service messages.

This commit is contained in:
levlam 2022-11-17 13:22:24 +03:00
parent 66032b4ccf
commit 3143d0ead7
2 changed files with 16 additions and 6 deletions

View File

@ -30,10 +30,6 @@ class ForumTopicEditedData {
public:
ForumTopicEditedData() = default;
bool is_empty() const {
return title_.empty() && !edit_icon_custom_emoji_id_ && !edit_is_closed_;
}
ForumTopicEditedData(string &&title, bool edit_icon_custom_emoji_id, int64 icon_custom_emoji_id, bool edit_is_closed,
bool is_closed)
: title_(std::move(title))
@ -43,6 +39,14 @@ class ForumTopicEditedData {
, is_closed_(is_closed) {
}
bool is_empty() const {
return title_.empty() && !edit_icon_custom_emoji_id_ && !edit_is_closed_;
}
const string &get_title() const {
return title_;
}
td_api::object_ptr<td_api::MessageContent> get_message_content_object() const;
template <class StorerT>

View File

@ -5784,6 +5784,14 @@ string get_message_content_search_text(const Td *td, const MessageContent *conte
const auto *poll = static_cast<const MessagePoll *>(content);
return td->poll_manager_->get_poll_search_text(poll->poll_id);
}
case MessageContentType::TopicCreate: {
const auto *topic_create = static_cast<const MessageTopicCreate *>(content);
return topic_create->title;
}
case MessageContentType::TopicEdit: {
const auto *topic_edit = static_cast<const MessageTopicEdit *>(content);
return topic_edit->edited_data.get_title();
}
case MessageContentType::Contact:
case MessageContentType::Game:
case MessageContentType::LiveLocation:
@ -5825,8 +5833,6 @@ string get_message_content_search_text(const Td *td, const MessageContent *conte
case MessageContentType::WebViewDataSent:
case MessageContentType::WebViewDataReceived:
case MessageContentType::GiftPremium:
case MessageContentType::TopicCreate:
case MessageContentType::TopicEdit:
return string();
default:
UNREACHABLE();