diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index b3943d3e60..e485ad9cc4 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4165,6 +4165,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_video_stream_comment_ph" = "Comment"; "lng_video_stream_comment_paid_ph#one" = "Comment for {count} Star"; "lng_video_stream_comment_paid_ph#other" = "Comment for {count} Stars"; +"lng_video_stream_comments_disabled" = "Comments disabled."; "lng_video_stream_stars" = "Add Stars to highlight your comment"; "lng_video_stream_live" = "LIVE"; "lng_video_stream_watched#one" = "{count} watching"; diff --git a/Telegram/SourceFiles/data/data_group_call.cpp b/Telegram/SourceFiles/data/data_group_call.cpp index 6a3c18b95e..bf5bb9de88 100644 --- a/Telegram/SourceFiles/data/data_group_call.cpp +++ b/Telegram/SourceFiles/data/data_group_call.cpp @@ -128,6 +128,13 @@ bool GroupCall::loaded() const { return _version > 0; } +rpl::producer GroupCall::loadedValue() const { + if (loaded()) { + return rpl::single(true); + } + return _loadedChanges.events_starting_with(false); +} + bool GroupCall::rtmp() const { return _rtmp; } @@ -553,6 +560,9 @@ void GroupCall::applyCallFields(const MTPDgroupCall &data) { if (const auto as = data.vdefault_send_as()) { _savedSendAs = _peer->owner().peer(peerFromMTP(*as)); } + if (initial) { + _loadedChanges.fire(true); + } } void GroupCall::applyLocalUpdate( diff --git a/Telegram/SourceFiles/data/data_group_call.h b/Telegram/SourceFiles/data/data_group_call.h index cce8574bc2..9709d55898 100644 --- a/Telegram/SourceFiles/data/data_group_call.h +++ b/Telegram/SourceFiles/data/data_group_call.h @@ -81,6 +81,7 @@ public: [[nodiscard]] CallId id() const; [[nodiscard]] bool loaded() const; + [[nodiscard]] rpl::producer loadedValue() const; [[nodiscard]] bool rtmp() const; [[nodiscard]] GroupCallOrigin origin() const; [[nodiscard]] bool canManage() const; @@ -262,6 +263,7 @@ private: not_null _peer; int _version = 0; + rpl::event_stream _loadedChanges; mtpRequestId _participantsRequestId = 0; mtpRequestId _reloadRequestId = 0; crl::time _reloadLastFinished = 0; diff --git a/Telegram/SourceFiles/history/view/controls/compose_controls_common.h b/Telegram/SourceFiles/history/view/controls/compose_controls_common.h index 17badb7a9c..823a032081 100644 --- a/Telegram/SourceFiles/history/view/controls/compose_controls_common.h +++ b/Telegram/SourceFiles/history/view/controls/compose_controls_common.h @@ -46,6 +46,7 @@ enum class WriteRestrictionType { Rights, PremiumRequired, Frozen, + Hidden, }; struct WriteRestriction { diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index 55c0756fc0..d055594b8d 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -2901,9 +2901,11 @@ void ComposeControls::initVoiceRecordBar() { } void ComposeControls::updateWrappingVisibility() { - const auto hidden = _hidden.current(); const auto &restriction = _writeRestriction.current(); const auto restricted = !restriction.empty() && _writeRestricted; + using Type = HistoryView::Controls::WriteRestrictionType; + const auto hidden = _hidden.current() + || (restriction.type == Type::Hidden); if (_writeRestricted) { _writeRestricted->setVisible(!hidden && restricted); } diff --git a/Telegram/SourceFiles/media/stories/media_stories_reply.cpp b/Telegram/SourceFiles/media/stories/media_stories_reply.cpp index 701b8f93c0..ddb07519cf 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_reply.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_reply.cpp @@ -896,12 +896,17 @@ void ReplyArea::show( ? ReplyAreaType::Comment : ReplyAreaType::Reply; auto writeRestriction = stream - ? stream->messagesEnabledValue() | rpl::map([=](bool enabled) { + ? rpl::combine( + stream->messagesEnabledValue(), + stream->loadedValue() + ) | rpl::map([=](bool enabled, bool loaded) { using namespace HistoryView::Controls; - return enabled + return !loaded + ? WriteRestriction{ .type = WriteRestrictionType::Hidden } + : enabled ? WriteRestriction() : WriteRestriction{ - .text = u"Comments disabled."_q, + .text = tr::lng_video_stream_comments_disabled(tr::now), .type = WriteRestrictionType::Rights, }; }) | rpl::type_erased()