Merge commit 'f7c01e88e36d3e49f3bf4b37ea71865324b0ecaa'

This commit is contained in:
Andrea Cavalli 2020-12-30 02:20:47 +01:00
commit a6c0dbf160
5 changed files with 35 additions and 12 deletions

View File

@ -10668,7 +10668,7 @@ void ContactsManager::on_get_channel_participants_success(
total_count = static_cast<int32>(result.size());
}
const auto max_participant_count = get_channel_type(channel_id) == ChannelType::Megagroup ? 9750 : 195;
const auto max_participant_count = get_channel_type(channel_id) == ChannelType::Megagroup ? 975 : 195;
auto participant_count =
filter.is_recent() && total_count != 0 && total_count < max_participant_count ? total_count : -1;
int32 administrator_count = filter.is_administrators() ? total_count : -1;

View File

@ -498,16 +498,18 @@ class GetChannelMessagesQuery : public Td::ResultHandler {
auto info = td->messages_manager_->on_get_messages(result_ptr.move_as_ok(), "GetChannelMessagesQuery");
LOG_IF(ERROR, !info.is_channel_messages) << "Receive ordinary messages in GetChannelMessagesQuery";
vector<MessageId> empty_message_ids;
for (auto &message : info.messages) {
if (message->get_id() == telegram_api::messageEmpty::ID) {
auto message_id = MessagesManager::get_message_id(message, false);
if (message_id.is_valid()) {
empty_message_ids.push_back(message_id);
if (!td->auth_manager_->is_bot()) { // bots can receive messageEmpty because of their privacy mode
vector<MessageId> empty_message_ids;
for (auto &message : info.messages) {
if (message->get_id() == telegram_api::messageEmpty::ID) {
auto message_id = MessagesManager::get_message_id(message, false);
if (message_id.is_valid()) {
empty_message_ids.push_back(message_id);
}
}
}
td->messages_manager_->on_get_empty_messages(DialogId(channel_id_), std::move(empty_message_ids));
}
td->messages_manager_->on_get_empty_messages(DialogId(channel_id_), std::move(empty_message_ids));
td->messages_manager_->get_channel_difference_if_needed(
DialogId(channel_id_), std::move(info),
PromiseCreator::lambda(
@ -7199,8 +7201,10 @@ void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_p
LOG(INFO) << "Receive from " << source << " pending " << to_string(update);
CHECK(update != nullptr);
if (dialog_id.get_type() != DialogType::Channel) {
LOG(ERROR) << "Receive channel update in invalid " << dialog_id << " from " << source << ": "
<< oneline(to_string(update));
if (dialog_id != DialogId() || !td_->auth_manager_->is_bot()) {
LOG(ERROR) << "Receive channel update in invalid " << dialog_id << " from " << source << ": "
<< oneline(to_string(update));
}
promise.set_value(Unit());
return;
}
@ -32668,6 +32672,7 @@ void MessagesManager::delete_message_from_database(Dialog *d, MessageId message_
if (message_id.is_scheduled() && message_id.is_scheduled_server()) {
d->deleted_scheduled_server_message_ids.insert(message_id.get_scheduled_server_message_id());
} else {
// don't store failed to send message identifiers for bots to reduce memory usage
if (m == nullptr || !td_->auth_manager_->is_bot() || !m->is_failed_to_send) {
d->deleted_message_ids.insert(message_id);
}

View File

@ -69,7 +69,7 @@ class RequestActor : public Actor {
bool is_authorized = td->auth_manager_ && td->auth_manager_->is_authorized();
if (is_authorized) {
LOG(ERROR) << "Promise was lost";
do_send_error(Status::Error(500, "Query can't be answered due to bug in the TDLib"));
do_send_error(Status::Error(500, "Query can't be answered due to a bug in TDLib"));
} else {
do_send_error(Status::Error(401, "Unauthorized"));
}

View File

@ -1003,7 +1003,9 @@ void WebPagesManager::on_load_web_page_instant_view_from_database(WebPageId web_
void WebPagesManager::update_web_page_instant_view_load_requests(WebPageId web_page_id, bool force_update,
Result<> result) {
// TODO [Error : 0 : Lost promise] on closing
if (G()->close_flag() && result.is_error()) {
result = Status::Error(500, "Request aborted");
}
LOG(INFO) << "Update load requests for " << web_page_id;
auto it = load_web_page_instant_view_queries_.find(web_page_id);
if (it == load_web_page_instant_view_queries_.end()) {

View File

@ -3816,6 +3816,22 @@ class CliClient final : public Actor {
bool is_dark;
get_args(args, chat_id, is_dark);
send_request(td_api::make_object<td_api::getChatStatistics>(as_chat_id(chat_id), is_dark));
} else if (op == "sgs") {
string chat_id;
string message_id;
string user_id;
int32 score;
get_args(args, chat_id, message_id, user_id, score);
send_request(td_api::make_object<td_api::setGameScore>(as_chat_id(chat_id), as_message_id(message_id), true,
as_user_id(user_id), score, true));
} else if (op == "gghs") {
string chat_id;
string message_id;
string user_id;
int32 score;
get_args(args, chat_id, message_id, user_id, score);
send_request(td_api::make_object<td_api::getGameHighScores>(as_chat_id(chat_id), as_message_id(message_id),
as_user_id(user_id)));
} else if (op == "gmst") {
string chat_id;
string message_id;