Skip to content

Commit 54b8afa

Browse files
committed
Fix ephemeral message properties.
1 parent a825ffc commit 54b8afa

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

td/generate/scheme/td_api.tl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6086,7 +6086,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep
60866086
//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options
60876087
//@can_be_paid True, if the message can be paid using inputInvoiceMessage
60886088
//@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage
6089-
//@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage
6089+
//@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage. Ephemeral messages can be replied only by other ephemeral messages
60906090
//@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage
60916091
//@can_be_saved True, if content of the message can be saved locally
60926092
//@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage

td/telegram/MessagesManager.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8110,6 +8110,9 @@ bool MessagesManager::can_forward_message(DialogId from_dialog_id, const Message
81108110
if (m->message_id.is_scheduled()) {
81118111
return false;
81128112
}
8113+
if (!is_copy && !m->message_id.is_server()) {
8114+
return false;
8115+
}
81138116
switch (from_dialog_id.get_type()) {
81148117
case DialogType::User:
81158118
case DialogType::Chat:
@@ -8136,6 +8139,9 @@ bool MessagesManager::can_forward_message(DialogId from_dialog_id, const Message
81368139
bool MessagesManager::can_reply_to_message(const Dialog *d, MessageId message_id, const Message *m) const {
81378140
CHECK(d != nullptr);
81388141
auto dialog_id = d->dialog_id;
8142+
if (is_ephemeral_message(m)) {
8143+
return m->ephemeral_message_id != 0 && !m->is_outgoing;
8144+
}
81398145
if (!td_->auth_manager_->is_bot() && m != nullptr && m->is_topic_message && d->is_forum) {
81408146
auto forum_topic_id = ForumTopicId::from_top_thread_message_id(m->top_thread_message_id);
81418147
if (!td_->forum_topic_manager_->can_send_message_to_forum_topic(dialog_id, forum_topic_id)) {
@@ -15158,6 +15164,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
1515815164
message_id = m->message_id;
1515915165

1516015166
bool can_delete = can_delete_message(dialog_id, m);
15167+
bool is_ephemeral = is_ephemeral_message(m);
1516115168
bool is_scheduled = message_id.is_scheduled();
1516215169
bool is_from_saved_messages = (dialog_id == td_->dialog_manager_->get_my_dialog_id());
1516315170
bool can_delete_for_self = false;
@@ -15183,6 +15190,10 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
1518315190
can_delete_for_self = is_from_saved_messages;
1518415191
can_delete_for_all_users = !can_delete_for_self;
1518515192
}
15193+
if (is_ephemeral) {
15194+
can_delete_for_self = m->ephemeral_message_id == 0;
15195+
can_delete_for_all_users = !can_delete_for_self;
15196+
}
1518615197

1518715198
auto is_bot = td_->auth_manager_->is_bot();
1518815199
auto can_add_offer = can_add_message_offer(dialog_id, m);

0 commit comments

Comments
 (0)