Minor improvements.
This commit is contained in:
parent
5aaa20b4d9
commit
d1afd1c3b7
@ -5309,7 +5309,7 @@ createForumTopic chat_id:int53 name:string icon:forumTopicIcon = ForumTopicInfo;
|
|||||||
//@icon_custom_emoji_id Identifier of the new custom emoji for topic icon. Telegram Premium users can use any custom emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons
|
//@icon_custom_emoji_id Identifier of the new custom emoji for topic icon. Telegram Premium users can use any custom emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons
|
||||||
editForumTopic chat_id:int53 message_thread_id:int53 name:string icon_custom_emoji_id:int64 = Ok;
|
editForumTopic chat_id:int53 message_thread_id:int53 name:string icon_custom_emoji_id:int64 = Ok;
|
||||||
|
|
||||||
//@description Toggles is_closed state of a topic in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup unless the user is creator of the topic
|
//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup unless the user is creator of the topic
|
||||||
//@chat_id Identifier of the chat
|
//@chat_id Identifier of the chat
|
||||||
//@message_thread_id Message thread identifier of the forum topic
|
//@message_thread_id Message thread identifier of the forum topic
|
||||||
//@is_closed Pass true to close the topic; pass false to reopen it
|
//@is_closed Pass true to close the topic; pass false to reopen it
|
||||||
|
@ -375,7 +375,7 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
|
|||||||
auto old_topic_info = ForumTopicInfo(action->prev_topic_);
|
auto old_topic_info = ForumTopicInfo(action->prev_topic_);
|
||||||
auto new_topic_info = ForumTopicInfo(action->new_topic_);
|
auto new_topic_info = ForumTopicInfo(action->new_topic_);
|
||||||
if (old_topic_info.is_empty() || new_topic_info.is_empty() ||
|
if (old_topic_info.is_empty() || new_topic_info.is_empty() ||
|
||||||
old_topic_info.get_thread_id() != new_topic_info.get_thread_id()) {
|
old_topic_info.get_top_thread_message_id() != new_topic_info.get_top_thread_message_id()) {
|
||||||
LOG(ERROR) << "Receive " << to_string(action);
|
LOG(ERROR) << "Receive " << to_string(action);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "td/telegram/ForumTopic.h"
|
#include "td/telegram/ForumTopic.h"
|
||||||
|
|
||||||
#include "td/telegram/DraftMessage.h"
|
#include "td/telegram/DraftMessage.h"
|
||||||
|
#include "td/telegram/ServerMessageId.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
|
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
@ -39,7 +40,7 @@ td_api::object_ptr<td_api::forumTopic> ForumTopic::get_forum_topic_object(Td *td
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO draft_message = can_send_message(dialog_id, info_.get_thread_id()).is_ok() ? ... : nullptr;
|
// TODO draft_message = can_send_message(dialog_id, info_.get_top_thread_message_id()).is_ok() ? ... : nullptr;
|
||||||
// TODO last_message
|
// TODO last_message
|
||||||
auto draft_message = get_draft_message_object(draft_message_);
|
auto draft_message = get_draft_message_object(draft_message_);
|
||||||
return td_api::make_object<td_api::forumTopic>(
|
return td_api::make_object<td_api::forumTopic>(
|
||||||
|
@ -40,8 +40,8 @@ class ForumTopic {
|
|||||||
return info_.is_empty();
|
return info_.is_empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageId get_thread_id() const {
|
MessageId get_top_thread_message_id() const {
|
||||||
return info_.get_thread_id();
|
return info_.get_top_thread_message_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::forumTopic> get_forum_topic_object(Td *td) const;
|
td_api::object_ptr<td_api::forumTopic> get_forum_topic_object(Td *td) const;
|
||||||
|
@ -51,7 +51,7 @@ class ForumTopicInfo {
|
|||||||
return !top_thread_message_id_.is_valid();
|
return !top_thread_message_id_.is_valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageId get_thread_id() const {
|
MessageId get_top_thread_message_id() const {
|
||||||
return top_thread_message_id_;
|
return top_thread_message_id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,16 +8,20 @@
|
|||||||
|
|
||||||
#include "td/telegram/AccessRights.h"
|
#include "td/telegram/AccessRights.h"
|
||||||
#include "td/telegram/AuthManager.h"
|
#include "td/telegram/AuthManager.h"
|
||||||
|
#include "td/telegram/ChannelId.h"
|
||||||
#include "td/telegram/ContactsManager.h"
|
#include "td/telegram/ContactsManager.h"
|
||||||
#include "td/telegram/CustomEmojiId.h"
|
#include "td/telegram/CustomEmojiId.h"
|
||||||
|
#include "td/telegram/ForumTopicIcon.h"
|
||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
#include "td/telegram/MessagesManager.h"
|
#include "td/telegram/MessagesManager.h"
|
||||||
#include "td/telegram/misc.h"
|
#include "td/telegram/misc.h"
|
||||||
|
#include "td/telegram/ServerMessageId.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
#include "td/telegram/telegram_api.h"
|
#include "td/telegram/telegram_api.h"
|
||||||
#include "td/telegram/UpdatesManager.h"
|
#include "td/telegram/UpdatesManager.h"
|
||||||
|
|
||||||
#include "td/utils/buffer.h"
|
#include "td/utils/buffer.h"
|
||||||
|
#include "td/utils/logging.h"
|
||||||
#include "td/utils/Random.h"
|
#include "td/utils/Random.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
@ -311,7 +315,7 @@ ForumTopicInfo *ForumTopicManager::add_topic_info(DialogId dialog_id, unique_ptr
|
|||||||
CHECK(dialog_info != nullptr);
|
CHECK(dialog_info != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageId top_thread_message_id = forum_topic_info->get_thread_id();
|
MessageId top_thread_message_id = forum_topic_info->get_top_thread_message_id();
|
||||||
auto topic_info = dialog_info->topic_infos_.get_pointer(top_thread_message_id);
|
auto topic_info = dialog_info->topic_infos_.get_pointer(top_thread_message_id);
|
||||||
if (topic_info == nullptr) {
|
if (topic_info == nullptr) {
|
||||||
dialog_info->topic_infos_.set(top_thread_message_id, std::move(forum_topic_info));
|
dialog_info->topic_infos_.set(top_thread_message_id, std::move(forum_topic_info));
|
||||||
|
@ -10,12 +10,14 @@
|
|||||||
#include "td/telegram/DialogId.h"
|
#include "td/telegram/DialogId.h"
|
||||||
#include "td/telegram/ForumTopicEditedData.h"
|
#include "td/telegram/ForumTopicEditedData.h"
|
||||||
#include "td/telegram/ForumTopicInfo.h"
|
#include "td/telegram/ForumTopicInfo.h"
|
||||||
|
#include "td/telegram/MessageId.h"
|
||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
|
|
||||||
#include "td/actor/actor.h"
|
#include "td/actor/actor.h"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/Promise.h"
|
#include "td/utils/Promise.h"
|
||||||
|
#include "td/utils/Status.h"
|
||||||
#include "td/utils/WaitFreeHashMap.h"
|
#include "td/utils/WaitFreeHashMap.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
@ -5341,10 +5341,10 @@ void Td::on_request(uint64 id, const td_api::readAllChatMentions &request) {
|
|||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::readAllMessageThreadMentions &request) {
|
void Td::on_request(uint64 id, const td_api::readAllMessageThreadMentions &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
|
||||||
if (request.message_thread_id_ == 0) {
|
if (request.message_thread_id_ == 0) {
|
||||||
return send_error_raw(id, 400, "Invalid message thread identifier specified");
|
return send_error_raw(id, 400, "Invalid message thread identifier specified");
|
||||||
}
|
}
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
messages_manager_->read_all_dialog_mentions(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
|
messages_manager_->read_all_dialog_mentions(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
|
||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
@ -5357,10 +5357,10 @@ void Td::on_request(uint64 id, const td_api::readAllChatReactions &request) {
|
|||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::readAllMessageThreadReactions &request) {
|
void Td::on_request(uint64 id, const td_api::readAllMessageThreadReactions &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
|
||||||
if (request.message_thread_id_ == 0) {
|
if (request.message_thread_id_ == 0) {
|
||||||
return send_error_raw(id, 400, "Invalid message thread identifier specified");
|
return send_error_raw(id, 400, "Invalid message thread identifier specified");
|
||||||
}
|
}
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
messages_manager_->read_all_dialog_reactions(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
|
messages_manager_->read_all_dialog_reactions(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
|
||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
@ -6219,10 +6219,10 @@ void Td::on_request(uint64 id, const td_api::unpinAllChatMessages &request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::unpinAllMessageThreadMessages &request) {
|
void Td::on_request(uint64 id, const td_api::unpinAllMessageThreadMessages &request) {
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
|
||||||
if (request.message_thread_id_ == 0) {
|
if (request.message_thread_id_ == 0) {
|
||||||
return send_error_raw(id, 400, "Invalid message thread identifier specified");
|
return send_error_raw(id, 400, "Invalid message thread identifier specified");
|
||||||
}
|
}
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
messages_manager_->unpin_all_dialog_messages(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
|
messages_manager_->unpin_all_dialog_messages(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
|
||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,14 @@
|
|||||||
|
|
||||||
#include "td/telegram/FullMessageId.h"
|
#include "td/telegram/FullMessageId.h"
|
||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
|
#include "td/telegram/telegram_api.h"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/Promise.h"
|
#include "td/utils/Promise.h"
|
||||||
#include "td/utils/Status.h"
|
#include "td/utils/Status.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
class Td;
|
class Td;
|
||||||
|
@ -57,7 +57,6 @@
|
|||||||
#include "td/telegram/telegram_api.hpp"
|
#include "td/telegram/telegram_api.hpp"
|
||||||
#include "td/telegram/ThemeManager.h"
|
#include "td/telegram/ThemeManager.h"
|
||||||
#include "td/telegram/Usernames.h"
|
#include "td/telegram/Usernames.h"
|
||||||
#include "td/telegram/VoiceNotesManager.h"
|
|
||||||
#include "td/telegram/WebPagesManager.h"
|
#include "td/telegram/WebPagesManager.h"
|
||||||
|
|
||||||
#include "td/actor/MultiPromise.h"
|
#include "td/actor/MultiPromise.h"
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "td/utils/tl_storers.h"
|
#include "td/utils/tl_storers.h"
|
||||||
#include "td/utils/TlStorerToString.h"
|
#include "td/utils/TlStorerToString.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
#include "td/actor/actor.h"
|
#include "td/actor/actor.h"
|
||||||
|
|
||||||
|
#include "td/utils/buffer.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
|
#include "td/utils/misc.h"
|
||||||
#include "td/utils/Status.h"
|
#include "td/utils/Status.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/FlatHashMap.h"
|
#include "td/utils/FlatHashMap.h"
|
||||||
#include "td/utils/FlatHashSet.h"
|
#include "td/utils/FlatHashSet.h"
|
||||||
|
#include "td/utils/Promise.h"
|
||||||
|
#include "td/utils/Status.h"
|
||||||
#include "td/utils/WaitFreeHashMap.h"
|
#include "td/utils/WaitFreeHashMap.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/VoiceNotesManager.h"
|
#include "td/telegram/VoiceNotesManager.h"
|
||||||
|
|
||||||
#include "td/telegram/DialogId.h"
|
|
||||||
#include "td/telegram/Dimensions.h"
|
#include "td/telegram/Dimensions.h"
|
||||||
#include "td/telegram/files/FileManager.h"
|
#include "td/telegram/files/FileManager.h"
|
||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
#include "td/utils/benchmark.h"
|
#include "td/utils/benchmark.h"
|
||||||
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/ConcurrentHashTable.h"
|
#include "td/utils/ConcurrentHashTable.h"
|
||||||
#include "td/utils/misc.h"
|
#include "td/utils/misc.h"
|
||||||
#include "td/utils/port/Mutex.h"
|
#include "td/utils/port/Mutex.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user