2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Handle fwd_from without a link to the account.

This commit is contained in:
John Preston
2019-03-15 19:15:56 +04:00
parent 6d1193a751
commit a34e998c42
36 changed files with 503 additions and 192 deletions

View File

@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text_options.h"
#include "lang/lang_keys.h"
#include "support/support_helper.h"
#include "history/history_item_components.h"
#include "history/history_item.h"
#include "history/history.h"
#include "data/data_channel.h"
@@ -175,6 +176,7 @@ void paintRow(
not_null<Entry*> entry,
Dialogs::Key chat,
PeerData *from,
const HiddenSenderInfo *hiddenSenderInfo,
HistoryItem *item,
const Data::Draft *draft,
QDateTime date,
@@ -220,6 +222,13 @@ void paintRow(
st::dialogsPadding.y(),
fullWidth,
st::dialogsPhotoSize);
} else if (hiddenSenderInfo) {
hiddenSenderInfo->userpic.paint(
p,
st::dialogsPadding.x(),
st::dialogsPadding.y(),
fullWidth,
st::dialogsPhotoSize);
} else {
entry->paintUserpicLeft(
p,
@@ -382,6 +391,8 @@ void paintRow(
icon->paint(p, rectForName.topLeft() + QPoint(qMin(from->dialogName().maxWidth(), rectForName.width()), 0), fullWidth);
}
from->dialogName().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
} else if (hiddenSenderInfo) {
hiddenSenderInfo->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
} else {
p.setFont(st::msgNameFont);
auto text = entry->chatListName(); // TODO feed name with emoji
@@ -658,6 +669,7 @@ void RowPainter::paint(
entry,
row->key(),
from,
nullptr,
item,
cloudDraft,
displayDate,
@@ -684,7 +696,7 @@ void RowPainter::paint(
if (const auto searchChat = row->searchInChat()) {
if (const auto peer = searchChat.peer()) {
if (peer->isSelf()) {
return item->senderOriginal().get();
return item->senderOriginal();
} else if (!peer->isChannel() || peer->isMegagroup()) {
return item->from().get();
}
@@ -694,6 +706,16 @@ void RowPainter::paint(
? history->peer->migrateTo()
: history->peer.get();
}();
const auto hiddenSenderInfo = [&]() -> const HiddenSenderInfo* {
if (const auto searchChat = row->searchInChat()) {
if (const auto peer = searchChat.peer()) {
if (peer->isSelf()) {
return item->hiddenForwardedInfo();
}
}
}
return nullptr;
}();
const auto drawInDialogWay = [&] {
if (const auto searchChat = row->searchInChat()) {
if (const auto peer = searchChat.peer()) {
@@ -775,6 +797,7 @@ void RowPainter::paint(
history,
history,
from,
hiddenSenderInfo,
item,
cloudDraft,
ItemDateTime(item),