diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 5190581a6c..98f4a50edc 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -5417,7 +5417,7 @@ void HistoryWidget::checkMessagesTTL() { updateControlsGeometry(); updateControlsVisibility(); } - } else if (!_ttlInfo) { + } else if (!_ttlInfo || _ttlInfo->peer() != _peer) { _ttlInfo = std::make_unique( this, _peer); diff --git a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp index 987638687d..841fffb48a 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp @@ -92,7 +92,8 @@ void AutoDeleteSettingsBox( } TTLButton::TTLButton(not_null parent, not_null peer) -: _button(parent, st::historyMessagesTTL) { +: _peer(peer) +, _button(parent, st::historyMessagesTTL) { _button.setClickedCallback([=] { const auto canEdit = peer->isUser() || (peer->isChat() diff --git a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.h b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.h index f1dc37f22e..a0b38156bb 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.h +++ b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.h @@ -23,6 +23,10 @@ class TTLButton final { public: TTLButton(not_null parent, not_null peer); + [[nodiscard]] not_null peer() const { + return _peer; + } + void show(); void hide(); void move(int x, int y); @@ -30,6 +34,7 @@ public: [[nodiscard]] int width() const; private: + const not_null _peer; Ui::IconButton _button; };