Better createChatFilter/editChatFilter return type.
GitOrigin-RevId: 7c9d51add4bc3e2e7bfd92483b2daad83209503b
This commit is contained in:
parent
deb006416b
commit
1e53b71532
@ -3753,11 +3753,11 @@ addChatToList chat_id:int53 chat_list:ChatList = Ok;
|
||||
//@description Returns information about a chat filter by its identifier @chat_filter_id Chat filter identifier
|
||||
getChatFilter chat_filter_id:int32 = ChatFilter;
|
||||
|
||||
//@description Creates new chat filter @filter Chat filter
|
||||
createChatFilter filter:chatFilter = Ok;
|
||||
//@description Creates new chat filter. Returns information about the created chat filter @filter Chat filter
|
||||
createChatFilter filter:chatFilter = ChatFilterInfo;
|
||||
|
||||
//@description Edits existing chat filter @chat_filter_id Chat filter identifier @filter The edited chat filter
|
||||
editChatFilter chat_filter_id:int32 filter:chatFilter = Ok;
|
||||
//@description Edits existing chat filter. Returns information about the edited chat filter @chat_filter_id Chat filter identifier @filter The edited chat filter
|
||||
editChatFilter chat_filter_id:int32 filter:chatFilter = ChatFilterInfo;
|
||||
|
||||
//@description Deletes existing chat filter @chat_filter_id Chat filter identifier
|
||||
deleteChatFilter chat_filter_id:int32 = Ok;
|
||||
|
Binary file not shown.
@ -15508,7 +15508,8 @@ Result<unique_ptr<DialogFilter>> MessagesManager::create_dialog_filter(DialogFil
|
||||
return std::move(dialog_filter);
|
||||
}
|
||||
|
||||
void MessagesManager::create_dialog_filter(td_api::object_ptr<td_api::chatFilter> filter, Promise<Unit> &&promise) {
|
||||
void MessagesManager::create_dialog_filter(td_api::object_ptr<td_api::chatFilter> filter,
|
||||
Promise<td_api::object_ptr<td_api::chatFilterInfo>> &&promise) {
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
if (dialog_filters_.size() >= MAX_DIALOG_FILTERS) {
|
||||
return promise.set_error(Status::Error(400, "Maximum number of chat folders exceeded"));
|
||||
@ -15527,6 +15528,7 @@ void MessagesManager::create_dialog_filter(td_api::object_ptr<td_api::chatFilter
|
||||
}
|
||||
auto dialog_filter = r_dialog_filter.move_as_ok();
|
||||
CHECK(dialog_filter != nullptr);
|
||||
auto chat_filter_info = dialog_filter->get_chat_filter_info_object();
|
||||
|
||||
bool at_beginning = false;
|
||||
for (auto &recommended_dialog_filter : recommended_dialog_filters_) {
|
||||
@ -15540,11 +15542,11 @@ void MessagesManager::create_dialog_filter(td_api::object_ptr<td_api::chatFilter
|
||||
send_update_chat_filters();
|
||||
|
||||
synchronize_dialog_filters();
|
||||
promise.set_value(Unit());
|
||||
promise.set_value(std::move(chat_filter_info));
|
||||
}
|
||||
|
||||
void MessagesManager::edit_dialog_filter(DialogFilterId dialog_filter_id, td_api::object_ptr<td_api::chatFilter> filter,
|
||||
Promise<Unit> &&promise) {
|
||||
Promise<td_api::object_ptr<td_api::chatFilterInfo>> &&promise) {
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
auto old_dialog_filter = get_dialog_filter(dialog_filter_id);
|
||||
if (old_dialog_filter == nullptr) {
|
||||
@ -15557,9 +15559,10 @@ void MessagesManager::edit_dialog_filter(DialogFilterId dialog_filter_id, td_api
|
||||
}
|
||||
auto new_dialog_filter = r_dialog_filter.move_as_ok();
|
||||
CHECK(new_dialog_filter != nullptr);
|
||||
auto chat_filter_info = new_dialog_filter->get_chat_filter_info_object();
|
||||
|
||||
if (*new_dialog_filter == *old_dialog_filter) {
|
||||
return promise.set_value(Unit());
|
||||
return promise.set_value(std::move(chat_filter_info));
|
||||
}
|
||||
|
||||
edit_dialog_filter(std::move(new_dialog_filter), "edit_dialog_filter");
|
||||
@ -15567,7 +15570,7 @@ void MessagesManager::edit_dialog_filter(DialogFilterId dialog_filter_id, td_api
|
||||
send_update_chat_filters();
|
||||
|
||||
synchronize_dialog_filters();
|
||||
promise.set_value(Unit());
|
||||
promise.set_value(std::move(chat_filter_info));
|
||||
}
|
||||
|
||||
void MessagesManager::update_dialog_filter_on_server(unique_ptr<DialogFilter> &&dialog_filter) {
|
||||
|
@ -560,10 +560,11 @@ class MessagesManager : public Actor {
|
||||
|
||||
td_api::object_ptr<td_api::messageLinkInfo> get_message_link_info_object(const MessageLinkInfo &info) const;
|
||||
|
||||
void create_dialog_filter(td_api::object_ptr<td_api::chatFilter> filter, Promise<Unit> &&promise);
|
||||
void create_dialog_filter(td_api::object_ptr<td_api::chatFilter> filter,
|
||||
Promise<td_api::object_ptr<td_api::chatFilterInfo>> &&promise);
|
||||
|
||||
void edit_dialog_filter(DialogFilterId dialog_filter_id, td_api::object_ptr<td_api::chatFilter> filter,
|
||||
Promise<Unit> &&promise);
|
||||
Promise<td_api::object_ptr<td_api::chatFilterInfo>> &&promise);
|
||||
|
||||
void delete_dialog_filter(DialogFilterId dialog_filter_id, Promise<Unit> &&promise);
|
||||
|
||||
|
@ -5911,7 +5911,7 @@ void Td::on_request(uint64 id, td_api::createChatFilter &request) {
|
||||
}
|
||||
CLEAN_INPUT_STRING(request.filter_->title_);
|
||||
CLEAN_INPUT_STRING(request.filter_->icon_name_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
messages_manager_->create_dialog_filter(std::move(request.filter_), std::move(promise));
|
||||
}
|
||||
|
||||
@ -5922,7 +5922,7 @@ void Td::on_request(uint64 id, td_api::editChatFilter &request) {
|
||||
}
|
||||
CLEAN_INPUT_STRING(request.filter_->title_);
|
||||
CLEAN_INPUT_STRING(request.filter_->icon_name_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
messages_manager_->edit_dialog_filter(DialogFilterId(request.chat_filter_id_), std::move(request.filter_),
|
||||
std::move(promise));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user