Support getMessageThread with non-root messages in supergroups.
This commit is contained in:
parent
c55baf4c61
commit
86acab5250
@ -870,7 +870,7 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n
|
||||
//@can_be_deleted_for_all_users True, if the message can be deleted for all users
|
||||
//@can_get_added_reactions True, if the list of added reactions is available through getMessageAddedReactions
|
||||
//@can_get_statistics True, if the message statistics are available through getMessageStatistics
|
||||
//@can_get_message_thread True, if information about the message thread is available through getMessageThread
|
||||
//@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory
|
||||
//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers
|
||||
//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description through getMessageLink
|
||||
//@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message
|
||||
|
@ -18030,10 +18030,6 @@ Result<FullMessageId> MessagesManager::get_top_thread_full_message_id(DialogId d
|
||||
if (!m->message_id.is_server()) {
|
||||
return Status::Error(400, "Message thread is unavailable for the message");
|
||||
}
|
||||
if (m->top_thread_message_id != m->message_id &&
|
||||
!td_->contacts_manager_->get_channel_has_linked_channel(dialog_id.get_channel_id())) {
|
||||
return Status::Error(400, "Root message must be used to get the message thread");
|
||||
}
|
||||
return FullMessageId{dialog_id, m->top_thread_message_id};
|
||||
}
|
||||
}
|
||||
@ -18061,6 +18057,13 @@ void MessagesManager::get_message_thread(DialogId dialog_id, MessageId message_i
|
||||
}
|
||||
|
||||
TRY_RESULT_PROMISE(promise, top_thread_full_message_id, get_top_thread_full_message_id(dialog_id, m));
|
||||
if ((m->reply_info.is_empty() || !m->reply_info.is_comment) &&
|
||||
top_thread_full_message_id.get_message_id() != m->message_id) {
|
||||
CHECK(dialog_id == top_thread_full_message_id.get_dialog_id());
|
||||
// get information about the thread from the top message
|
||||
message_id = top_thread_full_message_id.get_message_id();
|
||||
CHECK(message_id.is_valid());
|
||||
}
|
||||
|
||||
auto query_promise = PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, message_id,
|
||||
promise = std::move(promise)](Result<MessageThreadInfo> result) mutable {
|
||||
@ -22025,6 +22028,13 @@ std::pair<DialogId, vector<MessageId>> MessagesManager::get_message_thread_histo
|
||||
return {};
|
||||
}
|
||||
top_thread_full_message_id = r_top_thread_full_message_id.move_as_ok();
|
||||
if ((m->reply_info.is_empty() || !m->reply_info.is_comment) &&
|
||||
top_thread_full_message_id.get_message_id() != m->message_id) {
|
||||
CHECK(dialog_id == top_thread_full_message_id.get_dialog_id());
|
||||
// get information about the thread from the top message
|
||||
message_id = top_thread_full_message_id.get_message_id();
|
||||
CHECK(message_id.is_valid());
|
||||
}
|
||||
|
||||
if (!top_thread_full_message_id.get_message_id().is_valid()) {
|
||||
CHECK(m->reply_info.is_comment);
|
||||
|
Loading…
Reference in New Issue
Block a user