Minor improvements.
This commit is contained in:
parent
ed32026958
commit
4d70d1e920
@ -553,7 +553,7 @@ chatPhotoStickerTypeCustomEmoji custom_emoji_id:int64 = ChatPhotoStickerType;
|
||||
|
||||
//@description Information about the sticker, which was used to create the chat photo. The sticker is shown at the center of the photo and occupies at most 67% of it
|
||||
//@type Type of the sticker
|
||||
//@background_fill Describes a fill of the background under the sticker; rotation angle in backgroundFillGradient isn't supported
|
||||
//@background_fill The fill to be used as background for the sticker; rotation angle in backgroundFillGradient isn't supported
|
||||
chatPhotoSticker type:ChatPhotoStickerType background_fill:BackgroundFill = ChatPhotoSticker;
|
||||
|
||||
//@description Animated variant of a chat photo in MPEG4 format
|
||||
@ -2955,13 +2955,13 @@ emojiCategories categories:vector<emojiCategory> = EmojiCategories;
|
||||
|
||||
//@class EmojiCategoryType @description Describes type of an emoji category
|
||||
|
||||
//@description The category should be used by default
|
||||
//@description The category must be used by default
|
||||
emojiCategoryTypeDefault = EmojiCategoryType;
|
||||
|
||||
//@description The category should be used for emoji status selection
|
||||
//@description The category must be used for emoji status selection
|
||||
emojiCategoryTypeEmojiStatus = EmojiCategoryType;
|
||||
|
||||
//@description The category should be used for chat photo emoji selection
|
||||
//@description The category must be used for chat photo emoji selection
|
||||
emojiCategoryTypeChatPhoto = EmojiCategoryType;
|
||||
|
||||
|
||||
|
@ -4237,11 +4237,11 @@ class SendScreenshotNotificationQuery final : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class SendBotRequestedPeer final : public Td::ResultHandler {
|
||||
class SendBotRequestedPeerQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit SendBotRequestedPeer(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
explicit SendBotRequestedPeerQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FullMessageId full_message_id, int32 button_id, DialogId requested_dialog_id) {
|
||||
@ -4269,7 +4269,7 @@ class SendBotRequestedPeer final : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
auto ptr = result_ptr.move_as_ok();
|
||||
LOG(INFO) << "Receive result for SendBotRequestedPeer: " << to_string(ptr);
|
||||
LOG(INFO) << "Receive result for SendBotRequestedPeerQuery: " << to_string(ptr);
|
||||
td_->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
|
||||
}
|
||||
|
||||
@ -29900,7 +29900,8 @@ void MessagesManager::share_dialog_with_bot(FullMessageId full_message_id, int32
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, m->reply_markup->check_shared_dialog(td_, button_id, shared_dialog_id));
|
||||
|
||||
td_->create_handler<SendBotRequestedPeer>(std::move(promise))->send(full_message_id, button_id, shared_dialog_id);
|
||||
td_->create_handler<SendBotRequestedPeerQuery>(std::move(promise))
|
||||
->send(full_message_id, button_id, shared_dialog_id);
|
||||
}
|
||||
|
||||
Result<MessageId> MessagesManager::add_local_message(
|
||||
|
@ -6,10 +6,8 @@
|
||||
//
|
||||
#include "td/telegram/PhotoSize.h"
|
||||
|
||||
#include "td/telegram/CustomEmojiId.h"
|
||||
#include "td/telegram/files/FileLocation.h"
|
||||
#include "td/telegram/files/FileManager.h"
|
||||
#include "td/telegram/StickersManager.h"
|
||||
#include "td/telegram/Td.h"
|
||||
|
||||
#include "td/utils/base64.h"
|
||||
|
@ -772,8 +772,8 @@ unique_ptr<ReplyMarkup> dup_reply_markup(const unique_ptr<ReplyMarkup> &reply_ma
|
||||
result->is_personal = reply_markup->is_personal;
|
||||
result->is_persistent = reply_markup->is_persistent;
|
||||
result->need_resize_keyboard = reply_markup->need_resize_keyboard;
|
||||
result->keyboard = td::transform(reply_markup->keyboard, [](const vector<KeyboardButton> &row) {
|
||||
return td::transform(row, [](const KeyboardButton &button) {
|
||||
result->keyboard = transform(reply_markup->keyboard, [](const vector<KeyboardButton> &row) {
|
||||
return transform(row, [](const KeyboardButton &button) {
|
||||
KeyboardButton result;
|
||||
result.type = button.type;
|
||||
result.text = button.text;
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "td/telegram/StickersManager.h"
|
||||
#include "td/telegram/Td.h"
|
||||
|
||||
#include "td/utils/logging.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
Result<unique_ptr<StickerPhotoSize>> StickerPhotoSize::get_sticker_photo_size(
|
||||
|
@ -4854,7 +4854,7 @@ void StickersManager::reload_found_stickers(StickerType sticker_type, string &&e
|
||||
|
||||
void StickersManager::on_load_found_stickers_from_database(StickerType sticker_type, string emoji, string value) {
|
||||
if (G()->close_flag()) {
|
||||
on_search_stickers_failed(sticker_type, emoji, G()->close_status());
|
||||
on_search_stickers_failed(sticker_type, emoji, Global::request_aborted_error());
|
||||
return;
|
||||
}
|
||||
if (value.empty()) {
|
||||
@ -5005,7 +5005,7 @@ void StickersManager::on_find_custom_emojis_success(const string &emoji,
|
||||
void StickersManager::on_load_custom_emojis(string emoji, int64 hash, vector<CustomEmojiId> custom_emoji_ids,
|
||||
Result<td_api::object_ptr<td_api::stickers>> &&result) {
|
||||
if (result.is_ok() && G()->close_flag()) {
|
||||
result = G()->close_status();
|
||||
result = Global::request_aborted_error();
|
||||
}
|
||||
if (result.is_error()) {
|
||||
return on_find_custom_emojis_fail(emoji, result.move_as_error());
|
||||
@ -5393,7 +5393,7 @@ void StickersManager::load_installed_sticker_sets(StickerType sticker_type, Prom
|
||||
|
||||
void StickersManager::on_load_installed_sticker_sets_from_database(StickerType sticker_type, string value) {
|
||||
if (G()->close_flag()) {
|
||||
on_get_installed_sticker_sets_failed(sticker_type, G()->close_status());
|
||||
on_get_installed_sticker_sets_failed(sticker_type, Global::request_aborted_error());
|
||||
return;
|
||||
}
|
||||
if (value.empty()) {
|
||||
@ -6372,11 +6372,6 @@ void StickersManager::on_load_custom_emoji_from_database(CustomEmojiId custom_em
|
||||
auto promises = std::move(it->second);
|
||||
custom_emoji_load_queries_.erase(it);
|
||||
|
||||
if (G()->close_flag()) {
|
||||
fail_promises(promises, G()->close_status());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value.empty()) {
|
||||
LOG(INFO) << "Successfully loaded " << custom_emoji_id << " of size " << value.size() << " from database";
|
||||
CustomEmojiLogEvent log_event;
|
||||
@ -6558,7 +6553,7 @@ class StickersManager::CustomEmojiIdsLogEvent {
|
||||
|
||||
void StickersManager::on_load_default_dialog_photo_custom_emoji_ids_from_database(bool for_user, string value) {
|
||||
if (G()->close_flag()) {
|
||||
fail_promises(default_dialog_photo_custom_emoji_ids_load_queries_[for_user], G()->close_status());
|
||||
fail_promises(default_dialog_photo_custom_emoji_ids_load_queries_[for_user], Global::request_aborted_error());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -6581,14 +6576,14 @@ void StickersManager::on_load_default_dialog_photo_custom_emoji_ids_from_databas
|
||||
}
|
||||
|
||||
void StickersManager::reload_default_dialog_photo_custom_emoji_ids(bool for_user) {
|
||||
if (are_default_dialog_photo_custom_emoji_ids_being_loaded_[for_user]) {
|
||||
return;
|
||||
}
|
||||
if (G()->close_flag()) {
|
||||
fail_promises(default_dialog_photo_custom_emoji_ids_load_queries_[for_user], G()->close_status());
|
||||
fail_promises(default_dialog_photo_custom_emoji_ids_load_queries_[for_user], Global::request_aborted_error());
|
||||
return;
|
||||
}
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
if (are_default_dialog_photo_custom_emoji_ids_being_loaded_[for_user]) {
|
||||
return;
|
||||
}
|
||||
are_default_dialog_photo_custom_emoji_ids_being_loaded_[for_user] = true;
|
||||
|
||||
auto query_promise =
|
||||
@ -6603,12 +6598,12 @@ void StickersManager::reload_default_dialog_photo_custom_emoji_ids(bool for_user
|
||||
|
||||
void StickersManager::on_get_default_dialog_photo_custom_emoji_ids(
|
||||
bool for_user, Result<telegram_api::object_ptr<telegram_api::EmojiList>> r_emoji_list) {
|
||||
if (G()->close_flag()) {
|
||||
r_emoji_list = Global::request_aborted_error();
|
||||
}
|
||||
CHECK(are_default_dialog_photo_custom_emoji_ids_being_loaded_[for_user]);
|
||||
are_default_dialog_photo_custom_emoji_ids_being_loaded_[for_user] = false;
|
||||
|
||||
if (G()->close_flag()) {
|
||||
r_emoji_list = G()->close_status();
|
||||
}
|
||||
if (r_emoji_list.is_error()) {
|
||||
fail_promises(default_dialog_photo_custom_emoji_ids_load_queries_[for_user], r_emoji_list.move_as_error());
|
||||
return;
|
||||
@ -8760,7 +8755,7 @@ void StickersManager::load_recent_stickers(bool is_attached, Promise<Unit> &&pro
|
||||
|
||||
void StickersManager::on_load_recent_stickers_from_database(bool is_attached, string value) {
|
||||
if (G()->close_flag()) {
|
||||
fail_promises(load_recent_stickers_queries_[is_attached], G()->close_status());
|
||||
fail_promises(load_recent_stickers_queries_[is_attached], Global::request_aborted_error());
|
||||
return;
|
||||
}
|
||||
if (value.empty()) {
|
||||
@ -9161,7 +9156,7 @@ void StickersManager::load_favorite_stickers(Promise<Unit> &&promise) {
|
||||
|
||||
void StickersManager::on_load_favorite_stickers_from_database(const string &value) {
|
||||
if (G()->close_flag()) {
|
||||
fail_promises(load_favorite_stickers_queries_, G()->close_status());
|
||||
fail_promises(load_favorite_stickers_queries_, Global::request_aborted_error());
|
||||
return;
|
||||
}
|
||||
if (value.empty()) {
|
||||
@ -10017,7 +10012,7 @@ void StickersManager::get_emoji_groups(EmojiGroupType group_type,
|
||||
void StickersManager::on_load_emoji_groups_from_database(EmojiGroupType group_type, string used_language_codes,
|
||||
string value) {
|
||||
if (G()->close_flag()) {
|
||||
return on_get_emoji_groups(group_type, std::move(used_language_codes), G()->close_status());
|
||||
return on_get_emoji_groups(group_type, std::move(used_language_codes), Global::request_aborted_error());
|
||||
}
|
||||
if (value.empty()) {
|
||||
LOG(INFO) << "Emoji groups of type " << group_type << " aren't found in database";
|
||||
@ -10063,10 +10058,10 @@ void StickersManager::reload_emoji_groups(EmojiGroupType group_type, string used
|
||||
void StickersManager::on_get_emoji_groups(
|
||||
EmojiGroupType group_type, string used_language_codes,
|
||||
Result<telegram_api::object_ptr<telegram_api::messages_EmojiGroups>> r_emoji_groups) {
|
||||
auto type = static_cast<int32>(group_type);
|
||||
if (G()->close_flag() && r_emoji_groups.is_ok()) {
|
||||
r_emoji_groups = Global::request_aborted_error();
|
||||
}
|
||||
auto type = static_cast<int32>(group_type);
|
||||
if (r_emoji_groups.is_error()) {
|
||||
if (!G()->is_expected_error(r_emoji_groups.error())) {
|
||||
LOG(ERROR) << "Receive " << r_emoji_groups.error() << " from GetEmojiGroupsQuery";
|
||||
|
@ -910,6 +910,10 @@ void WebPagesManager::load_web_page_instant_view(WebPageId web_page_id, bool for
|
||||
}
|
||||
|
||||
void WebPagesManager::reload_web_page_instant_view(WebPageId web_page_id) {
|
||||
if (G()->close_flag()) {
|
||||
return update_web_page_instant_view_load_requests(web_page_id, true, Global::request_aborted_error());
|
||||
}
|
||||
|
||||
LOG(INFO) << "Reload " << web_page_id << " instant view";
|
||||
const WebPage *web_page = get_web_page(web_page_id);
|
||||
CHECK(web_page != nullptr && !web_page->instant_view.is_empty);
|
||||
@ -918,9 +922,6 @@ void WebPagesManager::reload_web_page_instant_view(WebPageId web_page_id) {
|
||||
send_closure(actor_id, &WebPagesManager::update_web_page_instant_view_load_requests, web_page_id, true,
|
||||
std::move(result));
|
||||
});
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
td_->create_handler<GetWebPageQuery>(std::move(promise))
|
||||
->send(web_page_id, web_page->url, web_page->instant_view.is_full ? web_page->instant_view.hash : 0);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ TEST(HttpUrl, parse_url) {
|
||||
if (c == '%') {
|
||||
continue;
|
||||
}
|
||||
char ch = static_cast<char>(c);
|
||||
auto ch = static_cast<char>(c);
|
||||
if (td::is_alnum(ch) || c >= 128 || td::string(".-_!$,~*\'();&+=").find(ch) != td::string::npos) {
|
||||
// allowed character
|
||||
test_parse_url(PSTRING() << ch << "a@b" << ch, td::string(1, ch) + "a", "b" + td::string(1, td::to_lower(ch)),
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
#include <queue>
|
||||
|
||||
class TestQueryMerger : public td::Actor {
|
||||
void start_up() override {
|
||||
class TestQueryMerger final : public td::Actor {
|
||||
void start_up() final {
|
||||
query_merger_.set_merge_function([this](td::vector<td::int64> query_ids, td::Promise<td::Unit> &&promise) {
|
||||
ASSERT_TRUE(!query_ids.empty());
|
||||
ASSERT_EQ(query_ids.size(), td::min(next_query_ids_.size(), MAX_MERGED_QUERY_COUNT));
|
||||
@ -37,7 +37,7 @@ class TestQueryMerger : public td::Actor {
|
||||
td::Result<td::Unit> result) mutable {
|
||||
for (auto query_id : query_ids) {
|
||||
LOG(INFO) << "Complete " << query_id;
|
||||
bool is_erased = pending_query_ids_.erase(query_id);
|
||||
bool is_erased = pending_query_ids_.erase(query_id) > 0;
|
||||
ASSERT_TRUE(is_erased);
|
||||
}
|
||||
current_query_count_--;
|
||||
@ -49,7 +49,7 @@ class TestQueryMerger : public td::Actor {
|
||||
loop();
|
||||
}
|
||||
|
||||
void loop() override {
|
||||
void loop() final {
|
||||
std::size_t query_count = 0;
|
||||
std::size_t added_queries = td::Random::fast(1, 3);
|
||||
while (query_count++ < added_queries && total_query_count_++ < MAX_QUERY_COUNT) {
|
||||
|
Loading…
Reference in New Issue
Block a user