From b6a3bb4080418138807bc086825a2c25a4c262b6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 24 Dec 2018 16:22:29 +0400 Subject: [PATCH] Allow closing CreatePollBox by escape. --- Telegram/SourceFiles/boxes/create_poll_box.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index f56ad8b39e..3db3ab6b92 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -588,7 +588,10 @@ object_ptr CreatePollBox::setupContent() { const auto options = lifetime().make_state( getDelegate()->outerContainer(), container); - auto limit = options->usedCount() | rpl::map([=](int count) { + auto limit = options->usedCount() | rpl::after_next([=](int count) { + setCloseByEscape(!count); + setCloseByOutsideClick(!count); + }) | rpl::map([=](int count) { return (count < kMaxOptionsCount) ? lng_polls_create_limit(lt_count, kMaxOptionsCount - count) : lang(lng_polls_create_maximum); @@ -666,7 +669,4 @@ void CreatePollBox::prepare() { const auto inner = setInnerWidget(setupContent()); setDimensionsToContent(st::boxWideWidth, inner); - - setCloseByEscape(false); - setCloseByOutsideClick(false); }