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

Correctly display discussion posts sender.

This commit is contained in:
John Preston
2019-05-25 17:05:57 +02:00
parent 01054858a4
commit a64c8c52b4
7 changed files with 37 additions and 46 deletions

View File

@@ -577,32 +577,6 @@ int HistoryMessage::viewsCount() const {
return HistoryItem::viewsCount();
}
ChannelData *HistoryMessage::discussionPostOriginalSender() const {
if (!history()->peer->isMegagroup()) {
return nullptr;
}
if (const auto forwarded = Get<HistoryMessageForwarded>()) {
const auto from = forwarded->savedFromPeer;
if (const auto result = from ? from->asChannel() : nullptr) {
return result;
}
}
return nullptr;
}
bool HistoryMessage::isDiscussionPost() const {
return (discussionPostOriginalSender() != nullptr);
}
PeerData *HistoryMessage::displayFrom() const {
if (const auto sender = discussionPostOriginalSender()) {
return sender;
} else if (history()->peer->isSelf()) {
return senderOriginal();
}
return author().get();
}
bool HistoryMessage::updateDependencyItem() {
if (const auto reply = Get<HistoryMessageReply>()) {
return reply->updateData(this, true);