mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-30 07:18:28 +00:00
Display saved messages senders correctly.
This commit is contained in:
parent
85d8273009
commit
8b3d203861
Telegram/SourceFiles
@ -501,7 +501,9 @@ void RowPainter::paint(
|
||||
auto cloudDraft = nullptr;
|
||||
auto from = [&] {
|
||||
if (auto searchPeer = row->searchInPeer()) {
|
||||
if (!searchPeer->isChannel() || searchPeer->isMegagroup()) {
|
||||
if (searchPeer->isSelf()) {
|
||||
return item->senderOriginal();
|
||||
} else if (!searchPeer->isChannel() || searchPeer->isMegagroup()) {
|
||||
return item->from();
|
||||
}
|
||||
}
|
||||
|
@ -1234,12 +1234,19 @@ QString HistoryItem::inDialogsText(DrawInDialog way) const {
|
||||
}
|
||||
return TextUtilities::Clean(_text.originalText());
|
||||
};
|
||||
auto plainText = getText();
|
||||
if ((!_history->peer->isUser() || out())
|
||||
&& !isPost()
|
||||
&& !isEmpty()
|
||||
&& (way != DrawInDialog::WithoutSender)) {
|
||||
auto fromText = author()->isSelf() ? lang(lng_from_you) : author()->shortName();
|
||||
const auto plainText = getText();
|
||||
const auto sender = [&]() -> PeerData* {
|
||||
if (isPost() || isEmpty() || (way == DrawInDialog::WithoutSender)) {
|
||||
return nullptr;
|
||||
} else if (!_history->peer->isUser() || out()) {
|
||||
return author();
|
||||
} else if (_history->peer->isSelf() && !hasOutLayout()) {
|
||||
return senderOriginal();
|
||||
}
|
||||
return nullptr;
|
||||
}();
|
||||
if (sender) {
|
||||
auto fromText = sender->isSelf() ? lang(lng_from_you) : sender->shortName();
|
||||
auto fromWrapped = textcmdLink(1, lng_dialogs_text_from_wrapped(lt_from, TextUtilities::Clean(fromText)));
|
||||
return lng_dialogs_text_with_from(lt_from_part, fromWrapped, lt_message, plainText);
|
||||
}
|
||||
|
@ -1616,7 +1616,9 @@ int HistoryMessage::infoWidth() const {
|
||||
if (auto views = Get<HistoryMessageViews>()) {
|
||||
result += st::historyViewsSpace + views->_viewsWidth + st::historyViewsWidth;
|
||||
} else if (id < 0 && history()->peer->isSelf()) {
|
||||
result += st::historySendStateSpace;
|
||||
if (!hasOutLayout()) {
|
||||
result += st::historySendStateSpace;
|
||||
}
|
||||
}
|
||||
if (hasOutLayout()) {
|
||||
result += st::historySendStateSpace;
|
||||
@ -1629,7 +1631,9 @@ int HistoryMessage::timeLeft() const {
|
||||
if (auto views = Get<HistoryMessageViews>()) {
|
||||
result += st::historyViewsSpace + views->_viewsWidth + st::historyViewsWidth;
|
||||
} else if (id < 0 && history()->peer->isSelf()) {
|
||||
result += st::historySendStateSpace;
|
||||
if (!hasOutLayout()) {
|
||||
result += st::historySendStateSpace;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -1697,7 +1701,7 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width
|
||||
auto iconSkip = st::historyViewsSpace + views->_viewsWidth;
|
||||
icon->paint(p, infoRight - infoW + iconSkip, infoBottom + st::historyViewsTop, width);
|
||||
}
|
||||
} else if (id < 0 && history()->peer->isSelf()) {
|
||||
} else if (id < 0 && history()->peer->isSelf() && !outbg) {
|
||||
auto icon = &(invertedsprites ? st::historyViewsSendingInvertedIcon : st::historyViewsSendingIcon);
|
||||
icon->paint(p, infoRight - infoW, infoBottom + st::historyViewsTop, width);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user