mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 14:08:41 +00:00
Fix tabs transfer between chat widgets.
This commit is contained in:
parent
c3860cfe72
commit
853757e611
@ -2474,6 +2474,7 @@ void HistoryWidget::showHistory(
|
|||||||
_silent.destroy();
|
_silent.destroy();
|
||||||
updateBotKeyboard();
|
updateBotKeyboard();
|
||||||
|
|
||||||
|
_subsectionCheckLifetime.destroy();
|
||||||
if (_subsectionTabs) {
|
if (_subsectionTabs) {
|
||||||
_subsectionTabsLifetime.destroy();
|
_subsectionTabsLifetime.destroy();
|
||||||
controller()->saveSubsectionTabs(base::take(_subsectionTabs));
|
controller()->saveSubsectionTabs(base::take(_subsectionTabs));
|
||||||
@ -2623,7 +2624,6 @@ void HistoryWidget::showHistory(
|
|||||||
channel->flagsValue(
|
channel->flagsValue(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
refreshJoinChannelText();
|
refreshJoinChannelText();
|
||||||
validateSubsectionTabs();
|
|
||||||
}, _list->lifetime());
|
}, _list->lifetime());
|
||||||
} else {
|
} else {
|
||||||
refreshJoinChannelText();
|
refreshJoinChannelText();
|
||||||
@ -8245,6 +8245,21 @@ void HistoryWidget::showPremiumToast(not_null<DocumentData*> document) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::validateSubsectionTabs() {
|
void HistoryWidget::validateSubsectionTabs() {
|
||||||
|
if (!_subsectionCheckLifetime
|
||||||
|
&& _history
|
||||||
|
&& _history->peer->isMegagroup()) {
|
||||||
|
_subsectionCheckLifetime = _history->peer->asChannel()->flagsValue(
|
||||||
|
) | rpl::skip(
|
||||||
|
1
|
||||||
|
) | rpl::filter([=](Data::Flags<ChannelDataFlags>::Change change) {
|
||||||
|
const auto mask = ChannelDataFlag::Forum
|
||||||
|
| ChannelDataFlag::ForumTabs
|
||||||
|
| ChannelDataFlag::MonoforumAdmin;
|
||||||
|
return change.diff & mask;
|
||||||
|
}) | rpl::start_with_next([=] {
|
||||||
|
validateSubsectionTabs();
|
||||||
|
});
|
||||||
|
}
|
||||||
if (!_history || !HistoryView::SubsectionTabs::UsedFor(_history)) {
|
if (!_history || !HistoryView::SubsectionTabs::UsedFor(_history)) {
|
||||||
if (_subsectionTabs) {
|
if (_subsectionTabs) {
|
||||||
_subsectionTabsLifetime.destroy();
|
_subsectionTabsLifetime.destroy();
|
||||||
|
@ -829,6 +829,7 @@ private:
|
|||||||
std::unique_ptr<HistoryView::ComposeSearch> _composeSearch;
|
std::unique_ptr<HistoryView::ComposeSearch> _composeSearch;
|
||||||
std::unique_ptr<HistoryView::SubsectionTabs> _subsectionTabs;
|
std::unique_ptr<HistoryView::SubsectionTabs> _subsectionTabs;
|
||||||
rpl::lifetime _subsectionTabsLifetime;
|
rpl::lifetime _subsectionTabsLifetime;
|
||||||
|
rpl::lifetime _subsectionCheckLifetime;
|
||||||
bool _cmdStartShown = false;
|
bool _cmdStartShown = false;
|
||||||
object_ptr<Ui::InputField> _field;
|
object_ptr<Ui::InputField> _field;
|
||||||
base::unique_qptr<Ui::RpWidget> _fieldDisabled;
|
base::unique_qptr<Ui::RpWidget> _fieldDisabled;
|
||||||
|
@ -928,7 +928,6 @@ void ChatWidget::setupComposeControls() {
|
|||||||
channel->flagsValue()
|
channel->flagsValue()
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
refreshJoinGroupButton();
|
refreshJoinGroupButton();
|
||||||
validateSubsectionTabs();
|
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
} else {
|
} else {
|
||||||
refreshJoinGroupButton();
|
refreshJoinGroupButton();
|
||||||
@ -1522,6 +1521,19 @@ void ChatWidget::edit(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::validateSubsectionTabs() {
|
void ChatWidget::validateSubsectionTabs() {
|
||||||
|
if (!_subsectionCheckLifetime && _history->peer->isMegagroup()) {
|
||||||
|
_subsectionCheckLifetime = _history->peer->asChannel()->flagsValue(
|
||||||
|
) | rpl::skip(
|
||||||
|
1
|
||||||
|
) | rpl::filter([=](Data::Flags<ChannelDataFlags>::Change change) {
|
||||||
|
const auto mask = ChannelDataFlag::Forum
|
||||||
|
| ChannelDataFlag::ForumTabs
|
||||||
|
| ChannelDataFlag::MonoforumAdmin;
|
||||||
|
return change.diff & mask;
|
||||||
|
}) | rpl::start_with_next([=] {
|
||||||
|
validateSubsectionTabs();
|
||||||
|
});
|
||||||
|
}
|
||||||
if (!HistoryView::SubsectionTabs::UsedFor(_history)) {
|
if (!HistoryView::SubsectionTabs::UsedFor(_history)) {
|
||||||
if (_subsectionTabs) {
|
if (_subsectionTabs) {
|
||||||
_subsectionTabsLifetime.destroy();
|
_subsectionTabsLifetime.destroy();
|
||||||
|
@ -409,6 +409,7 @@ private:
|
|||||||
std::unique_ptr<EmptyPainter> _emptyPainter;
|
std::unique_ptr<EmptyPainter> _emptyPainter;
|
||||||
std::unique_ptr<SubsectionTabs> _subsectionTabs;
|
std::unique_ptr<SubsectionTabs> _subsectionTabs;
|
||||||
rpl::lifetime _subsectionTabsLifetime;
|
rpl::lifetime _subsectionTabsLifetime;
|
||||||
|
rpl::lifetime _subsectionCheckLifetime;
|
||||||
bool _canSendTexts = false;
|
bool _canSendTexts = false;
|
||||||
bool _skipScrollEvent = false;
|
bool _skipScrollEvent = false;
|
||||||
bool _synteticScrollEvent = false;
|
bool _synteticScrollEvent = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user