diff --git a/Telegram/SourceFiles/api/api_statistics.cpp b/Telegram/SourceFiles/api/api_statistics.cpp index 4e97cf9074..ad0404dbea 100644 --- a/Telegram/SourceFiles/api/api_statistics.cpp +++ b/Telegram/SourceFiles/api/api_statistics.cpp @@ -725,6 +725,22 @@ rpl::producer EarnStatistics::request() { ).done([=](const MTPmessages_ChatFull &result) { result.data().vfull_chat().match([&]( const MTPDchannelFull &d) { + // Not a full ApplyChannelUpdate() here: that would + // re-trigger an EarnStatistics request and loop. We + // only refresh the revenue-visibility flags that + // gate this screen, which may be stale if the + // program was enabled after the last full load. + using Flag = ChannelDataFlag; + const auto channel = this->channel(); + channel->setFlags((channel->flags() + & ~(Flag::CanViewRevenue + | Flag::CanViewCreditsRevenue)) + | (d.is_can_view_revenue() + ? Flag::CanViewRevenue + : Flag()) + | (d.is_can_view_stars_revenue() + ? Flag::CanViewCreditsRevenue + : Flag())); _data.switchedOff = d.is_restricted_sponsored(); }, [](const auto &) { }); diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp index 4a7c46f5c5..e806c3658d 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp @@ -1411,7 +1411,7 @@ void InnerWidget::fill() { phrase()); button->toggleOn(rpl::single( - data.switchedOff + _state.currencyEarn.switchedOff ) | rpl::then(toggled->events())); button->setToggleLocked(isLocked);