Fix auto-delete button when switching between chats.
This commit is contained in:
parent
4896509ddf
commit
5b6503bfed
|
@ -5417,7 +5417,7 @@ void HistoryWidget::checkMessagesTTL() {
|
|||
updateControlsGeometry();
|
||||
updateControlsVisibility();
|
||||
}
|
||||
} else if (!_ttlInfo) {
|
||||
} else if (!_ttlInfo || _ttlInfo->peer() != _peer) {
|
||||
_ttlInfo = std::make_unique<HistoryView::Controls::TTLButton>(
|
||||
this,
|
||||
_peer);
|
||||
|
|
|
@ -92,7 +92,8 @@ void AutoDeleteSettingsBox(
|
|||
}
|
||||
|
||||
TTLButton::TTLButton(not_null<QWidget*> parent, not_null<PeerData*> peer)
|
||||
: _button(parent, st::historyMessagesTTL) {
|
||||
: _peer(peer)
|
||||
, _button(parent, st::historyMessagesTTL) {
|
||||
_button.setClickedCallback([=] {
|
||||
const auto canEdit = peer->isUser()
|
||||
|| (peer->isChat()
|
||||
|
|
|
@ -23,6 +23,10 @@ class TTLButton final {
|
|||
public:
|
||||
TTLButton(not_null<QWidget*> parent, not_null<PeerData*> peer);
|
||||
|
||||
[[nodiscard]] not_null<PeerData*> 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<PeerData*> _peer;
|
||||
Ui::IconButton _button;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue