Fix disable_web_page_preview flag of copied messages.
GitOrigin-RevId: 7b4c01436ab4bb8375307e57dd7b702cea5c289f
This commit is contained in:
parent
8e666c2d7a
commit
b89034d78b
@ -2512,7 +2512,7 @@ bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void has_message_content_web_page(const MessageContent *content) {
|
bool has_message_content_web_page(const MessageContent *content) {
|
||||||
if (content->get_type() == MessageContentType::Text) {
|
if (content->get_type() == MessageContentType::Text) {
|
||||||
return static_cast<const MessageText *>(content)->web_page_id.is_valid();
|
return static_cast<const MessageText *>(content)->web_page_id.is_valid();
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ bool get_message_content_poll_is_closed(const Td *td, const MessageContent *cont
|
|||||||
|
|
||||||
bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *content);
|
bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *content);
|
||||||
|
|
||||||
void has_message_content_web_page(const MessageContent *content);
|
bool has_message_content_web_page(const MessageContent *content);
|
||||||
|
|
||||||
void remove_message_content_web_page(MessageContent *content);
|
void remove_message_content_web_page(MessageContent *content);
|
||||||
|
|
||||||
|
@ -18439,7 +18439,8 @@ Result<InputMessageContent> MessagesManager::process_input_message_content(
|
|||||||
return Status::Error(400, "Can't copy message content");
|
return Status::Error(400, "Can't copy message content");
|
||||||
}
|
}
|
||||||
|
|
||||||
return InputMessageContent(std::move(content), copied_message->disable_web_page_preview, false, 0, UserId());
|
return InputMessageContent(std::move(content), get_message_disable_web_page_preview(copied_message), false, 0,
|
||||||
|
UserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
TRY_RESULT(content, get_input_message_content(dialog_id, std::move(input_message_content), td_));
|
TRY_RESULT(content, get_input_message_content(dialog_id, std::move(input_message_content), td_));
|
||||||
@ -20208,6 +20209,17 @@ void MessagesManager::edit_message_scheduling_state(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MessagesManager::get_message_disable_web_page_preview(const Message *m) {
|
||||||
|
// m->disable_web_page_preview is known only for sent from this client messages
|
||||||
|
if (m->disable_web_page_preview) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (m->content->get_type() != MessageContentType::Text) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !has_message_content_web_page(m->content.get());
|
||||||
|
}
|
||||||
|
|
||||||
int32 MessagesManager::get_message_flags(const Message *m) {
|
int32 MessagesManager::get_message_flags(const Message *m) {
|
||||||
int32 flags = 0;
|
int32 flags = 0;
|
||||||
if (m->reply_to_message_id.is_valid()) {
|
if (m->reply_to_message_id.is_valid()) {
|
||||||
@ -20820,7 +20832,7 @@ Result<vector<MessageId>> MessagesManager::forward_messages(DialogId to_dialog_i
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (need_copy) {
|
if (need_copy) {
|
||||||
copied_messages.push_back({std::move(content), forwarded_message->disable_web_page_preview, i});
|
copied_messages.push_back({std::move(content), get_message_disable_web_page_preview(forwarded_message), i});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2169,6 +2169,8 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
void cancel_send_deleted_message(DialogId dialog_id, Message *m, bool is_permanently_deleted);
|
void cancel_send_deleted_message(DialogId dialog_id, Message *m, bool is_permanently_deleted);
|
||||||
|
|
||||||
|
static bool get_message_disable_web_page_preview(const Message *m);
|
||||||
|
|
||||||
static int32 get_message_flags(const Message *m);
|
static int32 get_message_flags(const Message *m);
|
||||||
|
|
||||||
static bool is_forward_info_sender_hidden(const MessageForwardInfo *forward_info);
|
static bool is_forward_info_sender_hidden(const MessageForwardInfo *forward_info);
|
||||||
|
Reference in New Issue
Block a user