mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-03 07:56:03 +00:00
Fix editing price per message.
This commit is contained in:
@@ -999,6 +999,7 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
||||
= data.vsend_paid_messages_stars().has_value();
|
||||
if (!hasStarsPerMessage) {
|
||||
channel->setStarsPerMessage(0);
|
||||
_commonStarsPerMessage.remove(channel);
|
||||
} else if (const auto count = data.vsend_paid_messages_stars()->v) {
|
||||
_commonStarsPerMessage[channel] = count;
|
||||
} else {
|
||||
@@ -5141,7 +5142,20 @@ rpl::producer<SentFromScheduled> Session::sentFromScheduled() const {
|
||||
return _sentFromScheduled.events();
|
||||
}
|
||||
|
||||
int Session::commonStarsPerMessage(not_null<ChannelData*> channel) const {
|
||||
void Session::editStarsPerMessage(
|
||||
not_null<ChannelData*> channel,
|
||||
int count) {
|
||||
// For admin it's zero, we're admin if we can edit it.
|
||||
channel->setStarsPerMessage(0);
|
||||
if (count) {
|
||||
_commonStarsPerMessage[channel] = count;
|
||||
} else {
|
||||
_commonStarsPerMessage.remove(channel);
|
||||
}
|
||||
}
|
||||
|
||||
int Session::commonStarsPerMessage(
|
||||
not_null<const ChannelData*> channel) const {
|
||||
const auto i = _commonStarsPerMessage.find(channel);
|
||||
return (i != end(_commonStarsPerMessage)) ? i->second : 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user