Improve getMessageThread for forums.
This commit is contained in:
parent
fee05c93b5
commit
f58737a0c9
@ -1298,7 +1298,7 @@ webAppInfo launch_id:int64 url:string = WebAppInfo;
|
||||
//@description Contains information about a message thread
|
||||
//@chat_id Identifier of the chat to which the message thread belongs
|
||||
//@message_thread_id Message thread identifier, unique within the chat
|
||||
//@reply_info Information about the message thread
|
||||
//@reply_info Information about the message thread; may be null for forum topic threads
|
||||
//@unread_message_count Approximate number of unread messages in the message thread
|
||||
//@messages The messages from which the thread starts. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id)
|
||||
//@draft_message A draft of a message in the message thread; may be null
|
||||
|
@ -18827,6 +18827,7 @@ td_api::object_ptr<td_api::messageThreadInfo> MessagesManager::get_message_threa
|
||||
td_api::object_ptr<td_api::messageReplyInfo> reply_info;
|
||||
vector<td_api::object_ptr<td_api::message>> messages;
|
||||
messages.reserve(info.message_ids.size());
|
||||
bool is_forum_topic = false;
|
||||
for (auto message_id : info.message_ids) {
|
||||
const Message *m = get_message_force(d, message_id, "get_message_thread_info_object");
|
||||
auto message = get_message_object(d->dialog_id, m, "get_message_thread_info_object");
|
||||
@ -18835,10 +18836,14 @@ td_api::object_ptr<td_api::messageThreadInfo> MessagesManager::get_message_threa
|
||||
reply_info = m->reply_info.get_message_reply_info_object(td_);
|
||||
CHECK(reply_info != nullptr);
|
||||
}
|
||||
is_forum_topic = message->is_topic_message_;
|
||||
messages.push_back(std::move(message));
|
||||
}
|
||||
}
|
||||
if (reply_info == nullptr) {
|
||||
if (messages.size() != 1) {
|
||||
is_forum_topic = false;
|
||||
}
|
||||
if (reply_info == nullptr && !is_forum_topic) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user