Correctly handle shareable->non-shareable conversion.

This commit is contained in:
John Preston 2023-04-24 21:39:21 +04:00
parent f0acc9526e
commit 5ad4719c08

View File

@ -556,11 +556,12 @@ void EditFilterBox(
state->hasLinks = state->links.value() | rpl::map([=](const auto &v) { state->hasLinks = state->links.value() | rpl::map([=](const auto &v) {
return !v.empty(); return !v.empty();
}); });
if (!state->chatlist.current()) { state->hasLinks.value() | rpl::filter(
state->chatlist = state->hasLinks.value() | rpl::filter( _1
_1 ) | rpl::start_with_next([=] {
) | rpl::take(1); state->chatlist = true;
} }, box->lifetime());
const auto data = &state->rules; const auto data = &state->rules;
owner->chatsFilters().isChatlistChanged( owner->chatsFilters().isChatlistChanged(
@ -574,6 +575,9 @@ void EditFilterBox(
return; return;
} }
*data = data->current().withChatlist(i->chatlist(), i->hasMyLinks()); *data = data->current().withChatlist(i->chatlist(), i->hasMyLinks());
if (!i->chatlist() && !state->hasLinks.current()) {
state->chatlist = false;
}
}, box->lifetime()); }, box->lifetime());
box->setWidth(st::boxWideWidth); box->setWidth(st::boxWideWidth);