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

Display PSA label instead of the proxy sponsor.

This commit is contained in:
John Preston
2020-04-24 16:40:20 +04:00
parent 8d632bd2be
commit 266c1531ce
13 changed files with 94 additions and 22 deletions

View File

@@ -3713,21 +3713,28 @@ MessageIdsList Session::takeMimeForwardIds() {
return std::move(_mimeForwardIds);
}
void Session::setTopPromoted(PeerData *promoted) {
if (_topPromoted != promoted) {
if (const auto history = historyLoaded(_topPromoted)) {
history->cacheTopPromoted(false);
void Session::setTopPromoted(
PeerData *promoted,
const QString &type,
const QString &message) {
const auto changed = (_topPromoted != promoted);
const auto history = promoted ? this->history(promoted).get() : nullptr;
if (changed
|| (history && history->topPromotionMessage() != message)) {
if (changed) {
if (const auto history = historyLoaded(_topPromoted)) {
history->cacheTopPromoted(false, QString(), QString());
}
}
const auto old = std::exchange(_topPromoted, promoted);
if (_topPromoted) {
const auto history = this->history(_topPromoted);
history->cacheTopPromoted(true);
if (history) {
history->cacheTopPromoted(true, type, message);
history->requestChatListMessage();
Notify::peerUpdatedDelayed(
_topPromoted,
Notify::PeerUpdate::Flag::ChannelPromotedChanged);
}
if (old) {
if (changed && old) {
Notify::peerUpdatedDelayed(
old,
Notify::PeerUpdate::Flag::ChannelPromotedChanged);