Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group message data #1537

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions tests/ui_tools/test_popups.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,10 +1014,7 @@ def test_keypress_edit_history(

if self.msg_info_view.show_edit_history_label:
self.controller.show_edit_history.assert_called_once_with(
message=self.message,
topic_links=OrderedDict(),
message_links=OrderedDict(),
time_mentions=list(),
message=self.message
)
else:
self.controller.show_edit_history.assert_not_called()
Expand All @@ -1031,10 +1028,7 @@ def test_keypress_full_rendered_message(
self.msg_info_view.keypress(size, key)

self.controller.show_full_rendered_message.assert_called_once_with(
message=self.message,
topic_links=OrderedDict(),
message_links=OrderedDict(),
time_mentions=list(),
message=self.message
)

@pytest.mark.parametrize("key", keys_for_command("FULL_RAW_MESSAGE"))
Expand All @@ -1046,10 +1040,7 @@ def test_keypress_full_raw_message(
self.msg_info_view.keypress(size, key)

self.controller.show_full_raw_message.assert_called_once_with(
message=self.message,
topic_links=OrderedDict(),
message_links=OrderedDict(),
time_mentions=list(),
message=self.message
)

@pytest.mark.parametrize(
Expand Down
21 changes: 3 additions & 18 deletions zulipterminal/ui_tools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1725,30 +1725,15 @@ def create_link_buttons(

def keypress(self, size: urwid_Size, key: str) -> str:
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,
)
Comment on lines -1725 to -1730
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We removed some of these parameters in a previous commit. I'm aware that extra params can be passed (like we did after that commit), though slightly concerned we didn't get any warning - though we don't have explicit tests for them I guess? In any case it may be clearer commit-wise to pair the calling/definition changes into the same commits.

Nit: Again, a refactor commit :)

self.controller.show_edit_history(message=self.msg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: While self.msg isn't a great name - it'd be fine to refactor with a rename! - note that when there's only one parameter then it's normally fine to not need to specify it by keyword.

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=self.msg)
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=self.msg)
return key
return super().keypress(size, key)

Expand Down