Disallow pinning service messages.
GitOrigin-RevId: 18c23b8dbfe97e60e27fc605a145e11356231c38
This commit is contained in:
parent
65246318bb
commit
1049ae0630
@ -29871,7 +29871,8 @@ void MessagesManager::pin_dialog_message(DialogId dialog_id, MessageId message_i
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, can_pin_messages(dialog_id));
|
||||
|
||||
if (!have_message_force({dialog_id, message_id}, "pin_dialog_message")) {
|
||||
const Message *m = get_message_force(d, message_id, "pin_dialog_message");
|
||||
if (m == nullptr) {
|
||||
return promise.set_error(Status::Error(6, "Message not found"));
|
||||
}
|
||||
if (message_id.is_scheduled()) {
|
||||
@ -29881,6 +29882,10 @@ void MessagesManager::pin_dialog_message(DialogId dialog_id, MessageId message_i
|
||||
return promise.set_error(Status::Error(6, "Message can't be pinned"));
|
||||
}
|
||||
|
||||
if (!is_unpin && is_service_message_content(m->content->get_type())) {
|
||||
return promise.set_error(Status::Error(6, "Message can't be pinned"));
|
||||
}
|
||||
|
||||
if (only_for_self && dialog_id.get_type() != DialogType::User) {
|
||||
return promise.set_error(Status::Error(6, "Messages can't be pinned only for self in the chat"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user