Skip to content

Commit

Permalink
Disallow forwarding of empty messages.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 06c09cde285f440a86a420d2790da7c3751384c1
  • Loading branch information
levlam committed Aug 11, 2018
1 parent 4052bff commit 22d8d1e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions td/telegram/MessagesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8169,6 +8169,11 @@ bool MessagesManager::can_forward_message(DialogId from_dialog_id, const Message
}

auto content_id = m->content->get_id();
if (content_id == MessageText::ID) {
auto *text = static_cast<const MessageText *>(m->content.get());
return !text->text.text.empty(); // text can't be empty in the new message
}

return !is_service_message_content(content_id) && content_id != MessageUnsupported::ID &&
content_id != MessageExpiredPhoto::ID && content_id != MessageExpiredVideo::ID;
}
Expand Down

0 comments on commit 22d8d1e

Please sign in to comment.