File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
Telegram/SourceFiles/history Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -4718,6 +4718,9 @@ void HistoryInner::refreshAboutView(bool force) {
47184718 _aboutView->refreshRequests () | rpl::on_next ([=] {
47194719 updateBotInfo ();
47204720 }, _aboutView->lifetime ());
4721+ _aboutView->destroyRequests () | rpl::on_next ([=] {
4722+ refreshAboutView (true );
4723+ }, _aboutView->lifetime ());
47214724 _aboutView->sendIntroSticker () | rpl::start_to_stream (
47224725 _sendIntroSticker,
47234726 _aboutView->lifetime ());
Original file line number Diff line number Diff line change @@ -604,6 +604,14 @@ AboutView::AboutView(
604604 not_null<ElementDelegate*> delegate)
605605: _history(history)
606606, _delegate(delegate) {
607+ if (_history->peer ->isBot () && _history->peer ->isForum ()) {
608+ _history->session ().data ().newItemAdded (
609+ ) | rpl::on_next ([=](not_null<HistoryItem*> item) {
610+ if (item->history () == _history) {
611+ _destroyRequests.fire ({});
612+ }
613+ }, lifetime ());
614+ }
607615}
608616
609617AboutView::~AboutView () {
@@ -626,7 +634,13 @@ HistoryItem *AboutView::item() const {
626634}
627635
628636bool AboutView::aboveHistory () const {
629- return !_history->peer ->isBot () || !_history->isForum ();
637+ if (!_history->peer ->isBot () || !_history->isForum ()) {
638+ return true ;
639+ }
640+ const auto info = _history->peer ->asUser ()->botInfo .get ();
641+ return !(info->canManageTopics
642+ && info->startToken .isEmpty ()
643+ && (!_history->isEmpty () || _history->lastMessage ()));
630644}
631645
632646bool AboutView::refresh () {
@@ -774,6 +788,10 @@ rpl::producer<> AboutView::refreshRequests() const {
774788 return _refreshRequests.events ();
775789}
776790
791+ rpl::producer<> AboutView::destroyRequests () const {
792+ return _destroyRequests.events ();
793+ }
794+
777795rpl::lifetime &AboutView::lifetime () {
778796 return _lifetime;
779797}
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class AboutView final : public ClickHandlerHost {
3434 [[nodiscard]] auto sendIntroSticker () const
3535 -> rpl::producer<not_null<DocumentData*>>;
3636 [[nodiscard]] rpl::producer<> refreshRequests () const ;
37+ [[nodiscard]] rpl::producer<> destroyRequests () const ;
3738 [[nodiscard]] rpl::lifetime &lifetime ();
3839
3940 int top = 0 ;
@@ -73,6 +74,7 @@ class AboutView final : public ClickHandlerHost {
7374 bool _commonGroupsRequested = false ;
7475 std::vector<not_null<PeerData*>> _commonGroups;
7576 rpl::event_stream<> _refreshRequests;
77+ rpl::event_stream<> _destroyRequests;
7678 rpl::lifetime _lifetime;
7779
7880};
You can’t perform that action at this time.
0 commit comments