mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 23:00:58 +00:00
Fix sending messages with links.
This commit is contained in:
parent
39a80e9de7
commit
f0ed5640db
@ -3784,15 +3784,17 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) {
|
||||
if (!IsServerMsgId(d.vid.v)) {
|
||||
LOG(("API Error: Bad msgId got from server: %1").arg(d.vid.v));
|
||||
} else if (randomId) {
|
||||
PeerId peerId = 0;
|
||||
QString text;
|
||||
session().data().registerMessageSentData(randomId, peerId, text);
|
||||
|
||||
const auto wasAlready = (peerId != 0)
|
||||
&& (session().data().message(peerToChannel(peerId), d.vid.v) != nullptr);
|
||||
const auto sent = session().data().messageSentData(randomId);
|
||||
const auto lookupMessage = [&] {
|
||||
return sent.peerId
|
||||
? session().data().message(
|
||||
peerToChannel(sent.peerId),
|
||||
d.vid.v)
|
||||
: nullptr;
|
||||
};
|
||||
const auto wasAlready = (lookupMessage() != nullptr);
|
||||
feedUpdate(MTP_updateMessageID(d.vid, MTP_long(randomId))); // ignore real date
|
||||
if (peerId) {
|
||||
if (auto item = session().data().message(peerToChannel(peerId), d.vid.v)) {
|
||||
if (const auto item = lookupMessage()) {
|
||||
if (d.has_entities() && !MentionUsersLoaded(&session(), d.ventities)) {
|
||||
session().api().requestMessageData(
|
||||
item->history()->peer->asChannel(),
|
||||
@ -3803,14 +3805,13 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) {
|
||||
? TextUtilities::EntitiesFromMTP(d.ventities.v)
|
||||
: EntitiesInText();
|
||||
const auto media = d.has_media() ? &d.vmedia : nullptr;
|
||||
item->setText({ text, entities });
|
||||
item->setText({ sent.text, entities });
|
||||
item->updateSentMedia(media);
|
||||
if (!wasAlready) {
|
||||
item->indexAsNewItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ptsUpdateAndApply(d.vpts.v, d.vpts_count.v, updates)) {
|
||||
// Update date as well.
|
||||
|
Loading…
Reference in New Issue
Block a user