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

Display channels promoted by proxy on top.

This commit is contained in:
John Preston
2018-05-11 17:03:53 +03:00
parent df9ec4b466
commit d3f85b4c4e
25 changed files with 392 additions and 387 deletions

View File

@@ -83,10 +83,14 @@ void Session::setupChannelLeavingViewer() {
return update.peer->asChannel();
}) | rpl::filter([](ChannelData *channel) {
return (channel != nullptr)
&& !(channel->amIn())
&& (channel->feed() != nullptr);
&& !(channel->amIn());
}) | rpl::start_with_next([=](not_null<ChannelData*> channel) {
channel->clearFeed();
if (const auto history = App::historyLoaded(channel->id)) {
history->removeJoinedMessage();
history->updateChatListExistence();
history->updateChatListSortPosition();
}
}, _lifetime);
}
@@ -1592,4 +1596,24 @@ MessageIdsList Session::takeMimeForwardIds() {
return std::move(_mimeForwardIds);
}
void Session::setProxyPromoted(PeerData *promoted) {
if (_proxyPromoted != promoted) {
if (const auto history = App::historyLoaded(_proxyPromoted)) {
history->cacheProxyPromoted(false);
}
_proxyPromoted = promoted;
if (_proxyPromoted) {
const auto history = App::history(_proxyPromoted);
history->cacheProxyPromoted(true);
if (!history->lastMessageKnown()) {
_session->api().requestDialogEntry(history);
}
}
}
}
PeerData *Session::proxyPromoted() const {
return _proxyPromoted;
}
} // namespace Data