Skip to content

Commit d1c32a8

Browse files
committed
refactor: core: Extract PopUpConfirmationView instantiation as a method.
1 parent e6b0c68 commit d1c32a8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

zulipterminal/core.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from collections import OrderedDict
66
from functools import partial
77
from platform import platform
8-
from typing import Any, Optional, Tuple
8+
from typing import Any, Callable, Optional, Tuple
99

1010
import urwid
1111
import zulip
@@ -158,6 +158,12 @@ def show_about(self) -> None:
158158
server_feature_level=self.model.server_feature_level)
159159
)
160160

161+
def show_confirmation_overlay(self, question: Any,
162+
success_callback: Callable[[], bool],
163+
) -> None:
164+
self.loop.widget = PopUpConfirmationView(self, question,
165+
success_callback)
166+
161167
def search_messages(self, text: str) -> None:
162168
# Search for a text in messages
163169
self.model.index['search'].clear()
@@ -181,8 +187,7 @@ def stream_muting_confirmation_popup(self, button: Any) -> None:
181187
"center")
182188
mute_this_stream = partial(self.model.toggle_stream_muted_status,
183189
button.stream_id)
184-
self.loop.widget = PopUpConfirmationView(self, question,
185-
mute_this_stream)
190+
self.show_confirmation_overlay(question, mute_this_stream)
186191

187192
def _narrow_to(self, button: Any, anchor: Optional[int],
188193
**narrow: Any) -> None:

0 commit comments

Comments
 (0)