mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-01 15:05:56 +00:00
Fix editing direct message prices.
This commit is contained in:
@@ -362,8 +362,10 @@ void ShowEditPermissions(
|
|||||||
navigation->parentController()->show(Box(std::move(createBox)));
|
navigation->parentController()->show(Box(std::move(createBox)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] int CurrentPricePerMessage(ChannelData *monoforumLink) {
|
[[nodiscard]] int CurrentPricePerDirectMessage(
|
||||||
return monoforumLink
|
not_null<ChannelData*> broadcast) {
|
||||||
|
const auto monoforumLink = broadcast->monoforumLink();
|
||||||
|
return (monoforumLink && !monoforumLink->monoforumDisabled())
|
||||||
? monoforumLink->commonStarsPerMessage()
|
? monoforumLink->commonStarsPerMessage()
|
||||||
: -1;
|
: -1;
|
||||||
}
|
}
|
||||||
@@ -1090,8 +1092,7 @@ void Controller::fillDirectMessagesButton() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto monoforumLink = _peer->asChannel()->monoforumLink();
|
const auto perMessage = CurrentPricePerDirectMessage(_peer->asChannel());
|
||||||
const auto perMessage = CurrentPricePerMessage(monoforumLink);
|
|
||||||
_starsPerDirectMessageSavedValue = rpl::variable<int>(perMessage);
|
_starsPerDirectMessageSavedValue = rpl::variable<int>(perMessage);
|
||||||
|
|
||||||
auto label = _starsPerDirectMessageSavedValue->value(
|
auto label = _starsPerDirectMessageSavedValue->value(
|
||||||
@@ -2408,8 +2409,7 @@ void Controller::saveDirectMessagesPrice() {
|
|||||||
if (!channel) {
|
if (!channel) {
|
||||||
return continueSave();
|
return continueSave();
|
||||||
}
|
}
|
||||||
const auto monoforumLink = channel->monoforumLink();
|
const auto current = CurrentPricePerDirectMessage(channel);
|
||||||
const auto current = CurrentPricePerMessage(monoforumLink);
|
|
||||||
const auto desired = _savingData.starsPerDirectMessage
|
const auto desired = _savingData.starsPerDirectMessage
|
||||||
? *_savingData.starsPerDirectMessage
|
? *_savingData.starsPerDirectMessage
|
||||||
: current;
|
: current;
|
||||||
|
Reference in New Issue
Block a user