Add and use SavedMessagesManager::get_topic_ids.
This commit is contained in:
parent
7478bf3051
commit
121461561e
@ -320,12 +320,15 @@ SavedMessagesTopicId SavedMessagesManager::get_topic_id(int64 topic_id) const {
|
||||
}
|
||||
auto saved_messages_topic_id = SavedMessagesTopicId(DialogId(topic_id));
|
||||
if (saved_messages_topics_.count(saved_messages_topic_id) == 0) {
|
||||
// an invalid topic identifier
|
||||
return SavedMessagesTopicId(DialogId(std::numeric_limits<int64>::max()));
|
||||
return SavedMessagesTopicId(DialogId(std::numeric_limits<int64>::max())); // an invalid topic identifier
|
||||
}
|
||||
return saved_messages_topic_id;
|
||||
}
|
||||
|
||||
vector<SavedMessagesTopicId> SavedMessagesManager::get_topic_ids(const vector<int64> &topic_ids) const {
|
||||
return transform(topic_ids, [this](int64 topic_id) { return get_topic_id(topic_id); });
|
||||
}
|
||||
|
||||
int64 SavedMessagesManager::get_saved_messages_topic_id_object(SavedMessagesTopicId saved_messages_topic_id) {
|
||||
if (saved_messages_topic_id == SavedMessagesTopicId()) {
|
||||
return 0;
|
||||
|
@ -28,6 +28,8 @@ class SavedMessagesManager final : public Actor {
|
||||
|
||||
SavedMessagesTopicId get_topic_id(int64 topic_id) const;
|
||||
|
||||
vector<SavedMessagesTopicId> get_topic_ids(const vector<int64> &topic_ids) const;
|
||||
|
||||
int64 get_saved_messages_topic_id_object(SavedMessagesTopicId saved_messages_topic_id);
|
||||
|
||||
void set_topic_last_message_id(SavedMessagesTopicId saved_messages_topic_id, MessageId last_message_id,
|
||||
|
@ -5103,9 +5103,8 @@ void Td::on_request(uint64 id, const td_api::toggleSavedMessagesTopicIsPinned &r
|
||||
void Td::on_request(uint64 id, const td_api::setPinnedSavedMessagesTopics &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
auto saved_messages_topic_ids = transform(
|
||||
request.saved_messages_topic_ids_, [this](int64 topic) { return saved_messages_manager_->get_topic_id(topic); });
|
||||
saved_messages_manager_->set_pinned_saved_messages_topics(std::move(saved_messages_topic_ids), std::move(promise));
|
||||
saved_messages_manager_->set_pinned_saved_messages_topics(
|
||||
saved_messages_manager_->get_topic_ids(request.saved_messages_topic_ids_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::searchPublicChat &request) {
|
||||
|
Loading…
Reference in New Issue
Block a user