diff --git a/tests/ui_tools/test_popups.py b/tests/ui_tools/test_popups.py index 878be178c4..90ce1ec050 100644 --- a/tests/ui_tools/test_popups.py +++ b/tests/ui_tools/test_popups.py @@ -9,7 +9,11 @@ from zulipterminal.api_types import Message from zulipterminal.config.keys import is_command_key, keys_for_command from zulipterminal.config.ui_mappings import EDIT_MODE_CAPTIONS -from zulipterminal.helper import CustomProfileData, TidiedUserInfo +from zulipterminal.helper import ( + CustomProfileData, + MessageInfoPopupContent, + TidiedUserInfo, +) from zulipterminal.ui_tools.messages import MessageBox from zulipterminal.ui_tools.views import ( AboutView, @@ -41,6 +45,16 @@ # * classes derived from the base popup class, sorted alphabetically +@pytest.fixture +def message_info_content() -> MessageInfoPopupContent: + return MessageInfoPopupContent( + message=Message(), + topic_links=OrderedDict(), + message_links=OrderedDict(), + time_mentions=list(), + ) + + class TestPopUpConfirmationView: @pytest.fixture def popup_view(self, mocker: MockerFixture) -> PopUpConfirmationView: @@ -490,7 +504,12 @@ def test_keypress_exit_popup_invalid_key( class TestFullRenderedMsgView: @pytest.fixture(autouse=True) - def mock_external_classes(self, mocker: MockerFixture, msg_box: MessageBox) -> None: + def mock_external_classes( + self, + mocker: MockerFixture, + msg_box: MessageBox, + message_info_content: MessageInfoPopupContent, + ) -> None: self.controller = mocker.Mock() mocker.patch.object( self.controller, "maximum_popup_dimensions", return_value=(64, 64) @@ -499,23 +518,20 @@ def mock_external_classes(self, mocker: MockerFixture, msg_box: MessageBox) -> N # NOTE: Given that the FullRenderedMsgView just uses the message ID from # the message data currently, message_fixture is not used to avoid # adding extra test runs unnecessarily. - self.message = Message(id=1) + self.message_info_content = message_info_content + self.message_info_content["message"] = Message(id=1) self.full_rendered_message = FullRenderedMsgView( controller=self.controller, - message=self.message, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), title="Full Rendered Message", + message_info_content=message_info_content, ) def test_init(self, msg_box: MessageBox) -> None: assert self.full_rendered_message.title == "Full Rendered Message" assert self.full_rendered_message.controller == self.controller - assert self.full_rendered_message.message == self.message - assert self.full_rendered_message.topic_links == OrderedDict() - assert self.full_rendered_message.message_links == OrderedDict() - assert self.full_rendered_message.time_mentions == list() + assert ( + self.full_rendered_message.message_info_content == self.message_info_content + ) assert self.full_rendered_message.header.widget_list == msg_box.header assert self.full_rendered_message.footer.widget_list == msg_box.footer @@ -547,23 +563,26 @@ def test_keypress_exit_popup_invalid_key( }, ) def test_keypress_show_msg_info( - self, key: str, widget_size: Callable[[Widget], urwid_Size] + self, + key: str, + widget_size: Callable[[Widget], urwid_Size], + message_info_content: MessageInfoPopupContent, ) -> None: size = widget_size(self.full_rendered_message) self.full_rendered_message.keypress(size, key) - self.controller.show_msg_info.assert_called_once_with( - msg=self.message, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), - ) + self.controller.show_msg_info.assert_called_once_with(self.message_info_content) class TestFullRawMsgView: @pytest.fixture(autouse=True) - def mock_external_classes(self, mocker: MockerFixture, msg_box: MessageBox) -> None: + def mock_external_classes( + self, + mocker: MockerFixture, + msg_box: MessageBox, + message_info_content: MessageInfoPopupContent, + ) -> None: self.controller = mocker.Mock() mocker.patch.object( self.controller, "maximum_popup_dimensions", return_value=(64, 64) @@ -575,23 +594,18 @@ def mock_external_classes(self, mocker: MockerFixture, msg_box: MessageBox) -> N # NOTE: Given that the FullRawMsgView just uses the message ID from # the message data currently, message_fixture is not used to avoid # adding extra test runs unnecessarily. - self.message = Message(id=1) + self.message_info_content = message_info_content + self.message_info_content["message"] = Message(id=1) self.full_raw_message = FullRawMsgView( controller=self.controller, - message=self.message, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), title="Full Raw Message", + message_info_content=self.message_info_content, ) def test_init(self, msg_box: MessageBox) -> None: assert self.full_raw_message.title == "Full Raw Message" assert self.full_raw_message.controller == self.controller - assert self.full_raw_message.message == self.message - assert self.full_raw_message.topic_links == OrderedDict() - assert self.full_raw_message.message_links == OrderedDict() - assert self.full_raw_message.time_mentions == list() + assert self.full_raw_message.message_info_content == self.message_info_content assert self.full_raw_message.header.widget_list == msg_box.header assert self.full_raw_message.footer.widget_list == msg_box.footer @@ -629,17 +643,14 @@ def test_keypress_show_msg_info( self.full_raw_message.keypress(size, key) - self.controller.show_msg_info.assert_called_once_with( - msg=self.message, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), - ) + self.controller.show_msg_info.assert_called_once_with(self.message_info_content) class TestEditHistoryView: @pytest.fixture(autouse=True) - def mock_external_classes(self, mocker: MockerFixture) -> None: + def mock_external_classes( + self, mocker: MockerFixture, message_info_content: MessageInfoPopupContent + ) -> None: self.controller = mocker.Mock() mocker.patch.object( self.controller, "maximum_popup_dimensions", return_value=(64, 64) @@ -650,24 +661,20 @@ def mock_external_classes(self, mocker: MockerFixture) -> None: # NOTE: Given that the EditHistoryView just uses the message ID from # the message data currently, message_fixture is not used to avoid # adding extra test runs unnecessarily. - self.message = Message(id=1) + self.message_info_content = message_info_content + self.message_info_content["message"] = Message(id=1) self.edit_history_view = EditHistoryView( controller=self.controller, - message=self.message, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), title="Edit History", + message_info_content=self.message_info_content, ) def test_init(self) -> None: assert self.edit_history_view.controller == self.controller - assert self.edit_history_view.message == self.message - assert self.edit_history_view.topic_links == OrderedDict() - assert self.edit_history_view.message_links == OrderedDict() - assert self.edit_history_view.time_mentions == list() + assert self.edit_history_view.title == "Edit History" + assert self.edit_history_view.message_info_content == self.message_info_content self.controller.model.fetch_message_history.assert_called_once_with( - message_id=self.message["id"], + message_id=self.message_info_content["message"]["id"], ) @pytest.mark.parametrize("key", keys_for_command("MSG_INFO")) @@ -700,12 +707,7 @@ def test_keypress_show_msg_info( self.edit_history_view.keypress(size, key) - self.controller.show_msg_info.assert_called_once_with( - msg=self.message, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), - ) + self.controller.show_msg_info.assert_called_once_with(self.message_info_content) @pytest.mark.parametrize( "snapshot", @@ -958,7 +960,10 @@ def test_keypress_exit_popup( class TestMsgInfoView: @pytest.fixture(autouse=True) def mock_external_classes( - self, mocker: MockerFixture, message_fixture: Message + self, + mocker: MockerFixture, + message_fixture: Message, + message_info_content: MessageInfoPopupContent, ) -> None: self.controller = mocker.Mock() mocker.patch.object( @@ -975,32 +980,31 @@ def mock_external_classes( "Tue Mar 13 10:55:22", "Tue Mar 13 10:55:37", ] + self.message_info_content = message_info_content + self.message_info_content["message"] = message_fixture self.msg_info_view = MsgInfoView( self.controller, - message_fixture, "Message Information", - OrderedDict(), - OrderedDict(), - list(), + self.message_info_content, ) def test_init(self, message_fixture: Message) -> None: - assert self.msg_info_view.msg == message_fixture - assert self.msg_info_view.topic_links == OrderedDict() - assert self.msg_info_view.message_links == OrderedDict() - assert self.msg_info_view.time_mentions == list() + assert self.msg_info_view.message_info_content == self.message_info_content def test_pop_up_info_order(self, message_fixture: Message) -> None: topic_links = OrderedDict([("https://bar.com", ("topic", 1, True))]) message_links = OrderedDict([("image.jpg", ("image", 1, True))]) - msg_info_view = MsgInfoView( - self.controller, - message_fixture, - title="Message Information", + message_info_content = MessageInfoPopupContent( + message=message_fixture, topic_links=topic_links, message_links=message_links, time_mentions=list(), ) + msg_info_view = MsgInfoView( + self.controller, + title="Message Information", + message_info_content=message_info_content, + ) msg_links = msg_info_view.button_widgets assert msg_links == [message_links, topic_links] @@ -1043,11 +1047,8 @@ def test_keypress_edit_history( } msg_info_view = MsgInfoView( self.controller, - message_fixture, title="Message Information", - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), + message_info_content=self.message_info_content, ) size = widget_size(msg_info_view) @@ -1055,10 +1056,7 @@ def test_keypress_edit_history( if msg_info_view.show_edit_history_label: self.controller.show_edit_history.assert_called_once_with( - message=message_fixture, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), + self.message_info_content ) else: self.controller.show_edit_history.assert_not_called() @@ -1072,21 +1070,15 @@ def test_keypress_full_rendered_message( ) -> None: msg_info_view = MsgInfoView( self.controller, - message_fixture, title="Message Information", - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), + message_info_content=self.message_info_content, ) size = widget_size(msg_info_view) msg_info_view.keypress(size, key) self.controller.show_full_rendered_message.assert_called_once_with( - message=message_fixture, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), + self.message_info_content ) @pytest.mark.parametrize("key", keys_for_command("FULL_RAW_MESSAGE")) @@ -1098,21 +1090,15 @@ def test_keypress_full_raw_message( ) -> None: msg_info_view = MsgInfoView( self.controller, - message_fixture, title="Message Information", - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), + message_info_content=self.message_info_content, ) size = widget_size(msg_info_view) msg_info_view.keypress(size, key) self.controller.show_full_raw_message.assert_called_once_with( - message=message_fixture, - topic_links=OrderedDict(), - message_links=OrderedDict(), - time_mentions=list(), + self.message_info_content ) @pytest.mark.parametrize( @@ -1204,16 +1190,12 @@ def test_height_reactions( self, message_fixture: Message, to_vary_in_each_message: Message, + message_info_content: MessageInfoPopupContent, ) -> None: - varied_message = message_fixture - varied_message.update(to_vary_in_each_message) + message_info_content["message"] = message_fixture + message_info_content["message"].update(to_vary_in_each_message) self.msg_info_view = MsgInfoView( - self.controller, - varied_message, - "Message Information", - OrderedDict(), - OrderedDict(), - list(), + self.controller, "Message Information", message_info_content ) # 12 = 7 labels + 2 blank lines + 1 'Reactions' (category) # + 4 reactions (excluding 'Message Links'). diff --git a/zulipterminal/core.py b/zulipterminal/core.py index a23b1596f1..74cc624e3f 100644 --- a/zulipterminal/core.py +++ b/zulipterminal/core.py @@ -25,7 +25,7 @@ MAX_LINEAR_SCALING_WIDTH, MIN_SUPPORTED_POPUP_WIDTH, ) -from zulipterminal.helper import asynch, suppress_output +from zulipterminal.helper import MessageInfoPopupContent, asynch, suppress_output from zulipterminal.model import Model from zulipterminal.platform_code import PLATFORM from zulipterminal.ui import Screen, View @@ -262,20 +262,9 @@ def show_markdown_help(self) -> None: def show_topic_edit_mode(self, button: Any) -> None: self.show_pop_up(EditModeView(self, button), "area:msg") - def show_msg_info( - self, - msg: Message, - topic_links: Dict[str, Tuple[str, int, bool]], - message_links: Dict[str, Tuple[str, int, bool]], - time_mentions: List[Tuple[str, str]], - ) -> None: + def show_msg_info(self, message_info_content: MessageInfoPopupContent) -> None: msg_info_view = MsgInfoView( - self, - msg, - f"Message Information {SCROLL_PROMPT}", - topic_links, - message_links, - time_mentions, + self, f"Message Information {SCROLL_PROMPT}", message_info_content ) self.show_pop_up(msg_info_view, "area:msg") @@ -342,58 +331,29 @@ def show_msg_sender_info(self, user_id: int) -> None: ) def show_full_rendered_message( - self, - message: Message, - topic_links: Dict[str, Tuple[str, int, bool]], - message_links: Dict[str, Tuple[str, int, bool]], - time_mentions: List[Tuple[str, str]], + self, message_info_content: MessageInfoPopupContent ) -> None: self.show_pop_up( FullRenderedMsgView( - self, - message, - topic_links, - message_links, - time_mentions, - f"Full rendered message {SCROLL_PROMPT}", + self, f"Full rendered message {SCROLL_PROMPT}", message_info_content ), "area:msg", ) def show_full_raw_message( - self, - message: Message, - topic_links: Dict[str, Tuple[str, int, bool]], - message_links: Dict[str, Tuple[str, int, bool]], - time_mentions: List[Tuple[str, str]], + self, message_info_content: MessageInfoPopupContent ) -> None: self.show_pop_up( FullRawMsgView( - self, - message, - topic_links, - message_links, - time_mentions, - f"Full raw message {SCROLL_PROMPT}", + self, f"Full raw message {SCROLL_PROMPT}", message_info_content ), "area:msg", ) - def show_edit_history( - self, - message: Message, - topic_links: Dict[str, Tuple[str, int, bool]], - message_links: Dict[str, Tuple[str, int, bool]], - time_mentions: List[Tuple[str, str]], - ) -> None: + def show_edit_history(self, message_info_content: MessageInfoPopupContent) -> None: self.show_pop_up( EditHistoryView( - self, - message, - topic_links, - message_links, - time_mentions, - f"Edit History {SCROLL_PROMPT}", + self, f"Edit History {SCROLL_PROMPT}", message_info_content ), "area:msg", ) diff --git a/zulipterminal/helper.py b/zulipterminal/helper.py index a71d055b74..4d2d6cb30e 100644 --- a/zulipterminal/helper.py +++ b/zulipterminal/helper.py @@ -57,6 +57,13 @@ class StreamData(TypedDict): description: str +class MessageInfoPopupContent(TypedDict): + message: Message + topic_links: Dict[str, Tuple[str, int, bool]] + message_links: Dict[str, Tuple[str, int, bool]] + time_mentions: List[Tuple[str, str]] + + class EmojiData(TypedDict): code: str aliases: List[str] diff --git a/zulipterminal/ui_tools/messages.py b/zulipterminal/ui_tools/messages.py index b8552fdc92..3c47120548 100644 --- a/zulipterminal/ui_tools/messages.py +++ b/zulipterminal/ui_tools/messages.py @@ -29,7 +29,7 @@ TIME_MENTION_MARKER, ) from zulipterminal.config.ui_mappings import STATE_ICON, STREAM_ACCESS_TYPE -from zulipterminal.helper import get_unused_fence +from zulipterminal.helper import MessageInfoPopupContent, get_unused_fence from zulipterminal.server_url import near_message_url from zulipterminal.ui_tools.tables import render_table from zulipterminal.urwid_types import urwid_MarkupTuple, urwid_Size @@ -1121,7 +1121,12 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]: self.model.controller.view.middle_column.set_focus("footer") elif is_command_key("MSG_INFO", key): self.model.controller.show_msg_info( - self.message, self.topic_links, self.message_links, self.time_mentions + MessageInfoPopupContent( + message=self.message, + topic_links=self.topic_links, + message_links=self.message_links, + time_mentions=self.time_mentions, + ) ) elif is_command_key("ADD_REACTION", key): self.model.controller.show_emoji_picker(self.message) diff --git a/zulipterminal/ui_tools/views.py b/zulipterminal/ui_tools/views.py index 6d01a82566..6c9f77eff7 100644 --- a/zulipterminal/ui_tools/views.py +++ b/zulipterminal/ui_tools/views.py @@ -36,6 +36,7 @@ ) from zulipterminal.config.ui_sizes import LEFT_WIDTH from zulipterminal.helper import ( + MessageInfoPopupContent, TidiedUserInfo, asynch, match_emoji, @@ -1573,19 +1574,17 @@ class MsgInfoView(PopUpView): def __init__( self, controller: Any, - msg: Message, title: str, - topic_links: Dict[str, Tuple[str, int, bool]], - message_links: Dict[str, Tuple[str, int, bool]], - time_mentions: List[Tuple[str, str]], + message_info_content: MessageInfoPopupContent, ) -> None: - self.msg = msg - self.topic_links = topic_links - self.message_links = message_links - self.time_mentions = time_mentions + self.message_info_content = message_info_content + self.msg = message_info_content["message"] + self.topic_links = message_info_content["topic_links"] + self.message_links = message_info_content["message_links"] + self.time_mentions = message_info_content["time_mentions"] self.server_url = controller.model.server_url date_and_time = controller.model.formatted_local_time( - msg["timestamp"], show_seconds=True, show_year=True + self.msg["timestamp"], show_seconds=True, show_year=True ) view_in_browser_keys = "[{}]".format( ", ".join(map(str, display_keys_for_command("VIEW_IN_BROWSER"))) @@ -1602,8 +1601,8 @@ def __init__( "", [ ("Date & Time", date_and_time), - ("Sender", msg["sender_full_name"]), - ("Sender's Email ID", msg["sender_email"]), + ("Sender", self.msg["sender_full_name"]), + ("Sender's Email ID", self.msg["sender_email"]), ], ) ] @@ -1632,16 +1631,16 @@ def __init__( ) msg_info[1][1].append(("Edit History", keys)) # Render the category using the existing table methods if links exist. - if message_links: + if self.message_links: msg_info.append(("Message Links", [])) - if topic_links: + if self.topic_links: msg_info.append(("Topic Links", [])) - if time_mentions: - msg_info.append(("Time mentions", time_mentions)) - if msg["reactions"]: + if self.time_mentions: + msg_info.append(("Time mentions", self.time_mentions)) + if self.msg["reactions"]: reactions = sorted( (reaction["emoji_name"], reaction["user"]["full_name"]) - for reaction in msg["reactions"] + for reaction in self.msg["reactions"] ) grouped_reactions: Dict[str, str] = dict() for reaction, user in reactions: @@ -1658,9 +1657,9 @@ def __init__( # computing their slice indexes self.button_widgets: List[Any] = [] - if message_links: + if self.message_links: message_link_widgets, message_link_width = self.create_link_buttons( - controller, message_links + controller, self.message_links ) # slice_index = Number of labels before message links + 1 newline @@ -1669,16 +1668,16 @@ def __init__( slice_index = len(msg_info[0][1]) + len(msg_info[1][1]) + 2 + 2 slice_index += sum([len(w) + 2 for w in self.button_widgets]) - self.button_widgets.append(message_links) + self.button_widgets.append(self.message_links) widgets = ( widgets[:slice_index] + message_link_widgets + widgets[slice_index:] ) popup_width = max(popup_width, message_link_width) - if topic_links: + if self.topic_links: topic_link_widgets, topic_link_width = self.create_link_buttons( - controller, topic_links + controller, self.topic_links ) # slice_index = Number of labels before topic links + 1 newline @@ -1686,7 +1685,7 @@ def __init__( # + 2 for Viewing Actions category label and its newline slice_index = len(msg_info[0][1]) + len(msg_info[1][1]) + 2 + 2 slice_index += sum([len(w) + 2 for w in self.button_widgets]) - self.button_widgets.append(topic_links) + self.button_widgets.append(self.topic_links) widgets = widgets[:slice_index] + topic_link_widgets + widgets[slice_index:] popup_width = max(popup_width, topic_link_width) @@ -1721,31 +1720,22 @@ def create_link_buttons( return link_widgets, link_width def keypress(self, size: urwid_Size, key: str) -> str: + message_info_content = MessageInfoPopupContent( + message=self.msg, + topic_links=self.topic_links, + message_links=self.message_links, + time_mentions=self.time_mentions, + ) if is_command_key("EDIT_HISTORY", key) and self.show_edit_history_label: - self.controller.show_edit_history( - message=self.msg, - topic_links=self.topic_links, - message_links=self.message_links, - time_mentions=self.time_mentions, - ) + self.controller.show_edit_history(message_info_content) elif is_command_key("VIEW_IN_BROWSER", key): url = near_message_url(self.server_url[:-1], self.msg) self.controller.open_in_browser(url) elif is_command_key("FULL_RENDERED_MESSAGE", key): - self.controller.show_full_rendered_message( - message=self.msg, - topic_links=self.topic_links, - message_links=self.message_links, - time_mentions=self.time_mentions, - ) + self.controller.show_full_rendered_message(message_info_content) return key elif is_command_key("FULL_RAW_MESSAGE", key): - self.controller.show_full_raw_message( - message=self.msg, - topic_links=self.topic_links, - message_links=self.message_links, - time_mentions=self.time_mentions, - ) + self.controller.show_full_raw_message(message_info_content) return key return super().keypress(size, key) @@ -1794,17 +1784,12 @@ class EditHistoryView(PopUpView): def __init__( self, controller: Any, - message: Message, - topic_links: Dict[str, Tuple[str, int, bool]], - message_links: Dict[str, Tuple[str, int, bool]], - time_mentions: List[Tuple[str, str]], title: str, + message_info_content: MessageInfoPopupContent, ) -> None: self.controller = controller - self.message = message - self.topic_links = topic_links - self.message_links = message_links - self.time_mentions = time_mentions + self.message_info_content = message_info_content + self.message = message_info_content["message"] width = 64 widgets: List[Any] = [] @@ -1898,12 +1883,7 @@ def _get_author_prefix(snapshot: Dict[str, Any], tag: EditHistoryTag) -> str: def keypress(self, size: urwid_Size, key: str) -> str: if is_command_key("EXIT_POPUP", key) or is_command_key("EDIT_HISTORY", key): - self.controller.show_msg_info( - msg=self.message, - topic_links=self.topic_links, - message_links=self.message_links, - time_mentions=self.time_mentions, - ) + self.controller.show_msg_info(self.message_info_content) return key return super().keypress(size, key) @@ -1912,21 +1892,16 @@ class FullRenderedMsgView(PopUpView): def __init__( self, controller: Any, - message: Message, - topic_links: Dict[str, Tuple[str, int, bool]], - message_links: Dict[str, Tuple[str, int, bool]], - time_mentions: List[Tuple[str, str]], title: str, + message_info_content: MessageInfoPopupContent, ) -> None: self.controller = controller - self.message = message - self.topic_links = topic_links - self.message_links = message_links - self.time_mentions = time_mentions + self.message_info_content = message_info_content + self.message = message_info_content["message"] max_cols, max_rows = controller.maximum_popup_dimensions() # Get rendered message - msg_box = MessageBox(message, controller.model, None) + msg_box = MessageBox(self.message, controller.model, None) super().__init__( controller, @@ -1942,12 +1917,7 @@ def keypress(self, size: urwid_Size, key: str) -> str: if is_command_key("EXIT_POPUP", key) or is_command_key( "FULL_RENDERED_MESSAGE", key ): - self.controller.show_msg_info( - msg=self.message, - topic_links=self.topic_links, - message_links=self.message_links, - time_mentions=self.time_mentions, - ) + self.controller.show_msg_info(self.message_info_content) return key return super().keypress(size, key) @@ -1956,24 +1926,19 @@ class FullRawMsgView(PopUpView): def __init__( self, controller: Any, - message: Message, - topic_links: Dict[str, Tuple[str, int, bool]], - message_links: Dict[str, Tuple[str, int, bool]], - time_mentions: List[Tuple[str, str]], title: str, + message_info_content: MessageInfoPopupContent, ) -> None: self.controller = controller - self.message = message - self.topic_links = topic_links - self.message_links = message_links - self.time_mentions = time_mentions + self.message_info_content = message_info_content + self.message = message_info_content["message"] max_cols, max_rows = controller.maximum_popup_dimensions() # Get rendered message header and footer - msg_box = MessageBox(message, controller.model, None) + msg_box = MessageBox(self.message, controller.model, None) # Get raw message content widget list - response = controller.model.fetch_raw_message_content(message["id"]) + response = controller.model.fetch_raw_message_content(self.message["id"]) if response is None: return @@ -1992,12 +1957,7 @@ def __init__( def keypress(self, size: urwid_Size, key: str) -> str: if is_command_key("EXIT_POPUP", key) or is_command_key("FULL_RAW_MESSAGE", key): - self.controller.show_msg_info( - msg=self.message, - topic_links=self.topic_links, - message_links=self.message_links, - time_mentions=self.time_mentions, - ) + self.controller.show_msg_info(self.message_info_content) return key return super().keypress(size, key)