Use check_dialog_access_in_memory if appropriate.
This commit is contained in:
parent
c4e1a44a5c
commit
575acc5485
@ -380,9 +380,8 @@ void MessageImportManager::on_upload_imported_messages(FileId file_id,
|
|||||||
|
|
||||||
being_uploaded_imported_messages_.erase(it);
|
being_uploaded_imported_messages_.erase(it);
|
||||||
|
|
||||||
if (!td_->dialog_manager_->have_input_peer(dialog_id, false, AccessRights::Write)) {
|
TRY_STATUS_PROMISE(promise,
|
||||||
return promise.set_error(Status::Error(400, "Have no write access to the chat"));
|
td_->dialog_manager_->check_dialog_access_in_memory(dialog_id, false, AccessRights::Write));
|
||||||
}
|
|
||||||
|
|
||||||
FileView file_view = td_->file_manager_->get_file_view(file_id);
|
FileView file_view = td_->file_manager_->get_file_view(file_id);
|
||||||
CHECK(!file_view.is_encrypted());
|
CHECK(!file_view.is_encrypted());
|
||||||
@ -432,9 +431,8 @@ void MessageImportManager::on_upload_imported_messages_error(FileId file_id, Sta
|
|||||||
void MessageImportManager::start_import_messages(DialogId dialog_id, int64 import_id,
|
void MessageImportManager::start_import_messages(DialogId dialog_id, int64 import_id,
|
||||||
vector<FileId> &&attached_file_ids, Promise<Unit> &&promise) {
|
vector<FileId> &&attached_file_ids, Promise<Unit> &&promise) {
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
if (!td_->dialog_manager_->have_input_peer(dialog_id, false, AccessRights::Write)) {
|
TRY_STATUS_PROMISE(promise,
|
||||||
return promise.set_error(Status::Error(400, "Have no write access to the chat"));
|
td_->dialog_manager_->check_dialog_access_in_memory(dialog_id, false, AccessRights::Write));
|
||||||
}
|
|
||||||
|
|
||||||
auto pending_message_import = make_unique<PendingMessageImport>();
|
auto pending_message_import = make_unique<PendingMessageImport>();
|
||||||
pending_message_import->dialog_id = dialog_id;
|
pending_message_import->dialog_id = dialog_id;
|
||||||
@ -567,9 +565,8 @@ void MessageImportManager::on_imported_message_attachments_uploaded(int64 random
|
|||||||
auto promise = std::move(pending_message_import->promise);
|
auto promise = std::move(pending_message_import->promise);
|
||||||
auto dialog_id = pending_message_import->dialog_id;
|
auto dialog_id = pending_message_import->dialog_id;
|
||||||
|
|
||||||
if (!td_->dialog_manager_->have_input_peer(dialog_id, false, AccessRights::Write)) {
|
TRY_STATUS_PROMISE(promise,
|
||||||
return promise.set_error(Status::Error(400, "Have no write access to the chat"));
|
td_->dialog_manager_->check_dialog_access_in_memory(dialog_id, false, AccessRights::Write));
|
||||||
}
|
|
||||||
|
|
||||||
td_->create_handler<StartImportHistoryQuery>(std::move(promise))->send(dialog_id, pending_message_import->import_id);
|
td_->create_handler<StartImportHistoryQuery>(std::move(promise))->send(dialog_id, pending_message_import->import_id);
|
||||||
}
|
}
|
||||||
|
@ -1405,14 +1405,12 @@ FileSourceId NotificationSettingsManager::get_saved_ringtones_file_source_id() {
|
|||||||
void NotificationSettingsManager::send_get_dialog_notification_settings_query(DialogId dialog_id,
|
void NotificationSettingsManager::send_get_dialog_notification_settings_query(DialogId dialog_id,
|
||||||
MessageId top_thread_message_id,
|
MessageId top_thread_message_id,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot() || dialog_id.get_type() == DialogType::SecretChat) {
|
if (td_->auth_manager_->is_bot()) {
|
||||||
LOG(WARNING) << "Can't get notification settings for " << dialog_id;
|
LOG(ERROR) << "Can't get notification settings for " << dialog_id;
|
||||||
return promise.set_error(Status::Error(500, "Wrong getDialogNotificationSettings query"));
|
return promise.set_error(Status::Error(500, "Wrong getDialogNotificationSettings query"));
|
||||||
}
|
}
|
||||||
if (!td_->dialog_manager_->have_input_peer(dialog_id, false, AccessRights::Read)) {
|
TRY_STATUS_PROMISE(promise,
|
||||||
LOG(WARNING) << "Have no access to " << dialog_id << " to get notification settings";
|
td_->dialog_manager_->check_dialog_access_in_memory(dialog_id, false, AccessRights::Read));
|
||||||
return promise.set_error(Status::Error(400, "Can't access the chat"));
|
|
||||||
}
|
|
||||||
|
|
||||||
auto &promises = get_dialog_notification_settings_queries_[{dialog_id, top_thread_message_id}];
|
auto &promises = get_dialog_notification_settings_queries_[{dialog_id, top_thread_message_id}];
|
||||||
promises.push_back(std::move(promise));
|
promises.push_back(std::move(promise));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user