2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-04 08:25:38 +00:00

Save correct starsPerMessage for admins.

This commit is contained in:
John Preston
2025-07-02 12:04:29 +04:00
parent 13ecc6a56b
commit 33671e7737
3 changed files with 24 additions and 3 deletions

View File

@@ -999,6 +999,10 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
= data.vsend_paid_messages_stars().has_value();
if (!hasStarsPerMessage) {
channel->setStarsPerMessage(0);
} else if (const auto count = data.vsend_paid_messages_stars()->v) {
_commonStarsPerMessage[channel] = count;
} else {
_commonStarsPerMessage.remove(channel);
}
const auto storiesState = minimal
? std::optional<Data::Stories::PeerSourceState>()
@@ -5137,6 +5141,11 @@ rpl::producer<SentFromScheduled> Session::sentFromScheduled() const {
return _sentFromScheduled.events();
}
int Session::commonStarsPerMessage(not_null<ChannelData*> channel) const {
const auto i = _commonStarsPerMessage.find(channel);
return (i != end(_commonStarsPerMessage)) ? i->second : 0;
}
void Session::clearLocalStorage() {
_cache->close();
_cache->clear();