Adjust last_read_inbox_message_id in MessageReplyInfo by last read chat message.
This commit is contained in:
parent
f94e27fe12
commit
82b9d3493e
@ -196,7 +196,8 @@ bool MessageReplyInfo::need_reget(const Td *td) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::messageReplyInfo> MessageReplyInfo::get_message_reply_info_object(Td *td) const {
|
td_api::object_ptr<td_api::messageReplyInfo> MessageReplyInfo::get_message_reply_info_object(
|
||||||
|
Td *td, MessageId dialog_last_read_inbox_message_id) const {
|
||||||
if (is_empty()) {
|
if (is_empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -208,8 +209,12 @@ td_api::object_ptr<td_api::messageReplyInfo> MessageReplyInfo::get_message_reply
|
|||||||
recent_repliers.push_back(std::move(recent_replier));
|
recent_repliers.push_back(std::move(recent_replier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
auto last_read_inbox_message_id = last_read_inbox_message_id_;
|
||||||
|
if (last_read_inbox_message_id.is_valid() && last_read_inbox_message_id < dialog_last_read_inbox_message_id) {
|
||||||
|
last_read_inbox_message_id = min(dialog_last_read_inbox_message_id, max_message_id_);
|
||||||
|
}
|
||||||
return td_api::make_object<td_api::messageReplyInfo>(reply_count_, std::move(recent_repliers),
|
return td_api::make_object<td_api::messageReplyInfo>(reply_count_, std::move(recent_repliers),
|
||||||
last_read_inbox_message_id_.get(),
|
last_read_inbox_message_id.get(),
|
||||||
last_read_outbox_message_id_.get(), max_message_id_.get());
|
last_read_outbox_message_id_.get(), max_message_id_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ struct MessageReplyInfo {
|
|||||||
|
|
||||||
bool need_reget(const Td *td) const;
|
bool need_reget(const Td *td) const;
|
||||||
|
|
||||||
td_api::object_ptr<td_api::messageReplyInfo> get_message_reply_info_object(Td *td) const;
|
td_api::object_ptr<td_api::messageReplyInfo> get_message_reply_info_object(
|
||||||
|
Td *td, MessageId dialog_last_read_inbox_message_id) const;
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store(StorerT &storer) const;
|
void store(StorerT &storer) const;
|
||||||
|
@ -7189,7 +7189,10 @@ td_api::object_ptr<td_api::messageInteractionInfo> MessagesManager::get_message_
|
|||||||
|
|
||||||
td_api::object_ptr<td_api::messageReplyInfo> reply_info;
|
td_api::object_ptr<td_api::messageReplyInfo> reply_info;
|
||||||
if (is_visible_reply_info) {
|
if (is_visible_reply_info) {
|
||||||
reply_info = m->reply_info.get_message_reply_info_object(td_);
|
auto expected_dialog_id = m->reply_info.is_comment_ ? DialogId(m->reply_info.channel_id_) : dialog_id;
|
||||||
|
const Dialog *d = get_dialog(expected_dialog_id);
|
||||||
|
reply_info =
|
||||||
|
m->reply_info.get_message_reply_info_object(td_, d != nullptr ? d->last_read_inbox_message_id : MessageId());
|
||||||
CHECK(reply_info != nullptr);
|
CHECK(reply_info != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18773,7 +18776,7 @@ td_api::object_ptr<td_api::messageThreadInfo> MessagesManager::get_message_threa
|
|||||||
auto message = get_message_object(d->dialog_id, m, "get_message_thread_info_object");
|
auto message = get_message_object(d->dialog_id, m, "get_message_thread_info_object");
|
||||||
if (message != nullptr) {
|
if (message != nullptr) {
|
||||||
if (message->interaction_info_ != nullptr && message->interaction_info_->reply_info_ != nullptr) {
|
if (message->interaction_info_ != nullptr && message->interaction_info_->reply_info_ != nullptr) {
|
||||||
reply_info = m->reply_info.get_message_reply_info_object(td_);
|
reply_info = m->reply_info.get_message_reply_info_object(td_, d->last_read_inbox_message_id);
|
||||||
CHECK(reply_info != nullptr);
|
CHECK(reply_info != nullptr);
|
||||||
}
|
}
|
||||||
is_forum_topic = message->is_topic_message_;
|
is_forum_topic = message->is_topic_message_;
|
||||||
|
Loading…
Reference in New Issue
Block a user