diff --git a/docs/FAQ.md b/docs/FAQ.md index 04a5d160d9..03d839a679 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -369,7 +369,7 @@ through autocomplete depend upon the context automatically. * `P` (with stream color) if the stream is valid and private, * `✗` if the stream is invalid. -![PM recipients header](https://user-images.githubusercontent.com/55916430/118403345-9d422800-b68b-11eb-9005-6d2af74adab9.png) +![DM recipients header](https://user-images.githubusercontent.com/55916430/118403345-9d422800-b68b-11eb-9005-6d2af74adab9.png) **NOTE:** If a direct message recipient's name contains comma(s) (`,`), they are currently treated as comma-separated recipients. diff --git a/tests/config/test_keys.py b/tests/config/test_keys.py index 752e69af29..bb38bdb623 100644 --- a/tests/config/test_keys.py +++ b/tests/config/test_keys.py @@ -144,7 +144,7 @@ def test_display_key_for_urwid_key(urwid_key: str, display_key: str) -> None: COMMAND_TO_DISPLAY_KEYS = [ ("NEXT_LINE", ["Down", "Ctrl n"]), ("TOGGLE_STAR_STATUS", ["Ctrl s", "*"]), - ("ALL_PM", ["P"]), + ("ALL_DM", ["P"]), ] diff --git a/tests/conftest.py b/tests/conftest.py index 5b4b38377f..39c12a703a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -520,11 +520,11 @@ def direct_message_fixture(request: Any) -> Message: @pytest.fixture( params=["stream_msg_template", "dm_template", "group_dm_template"], - ids=["stream_message", "dm_message", "group_dm_message"], + ids=["stream_message", "pm_message", "group_pm_message"], ) def message_fixture(request: Any) -> Message: """ - Acts as a parametrize fixture for stream msg, dms and group_dms. + Acts as a parametrize fixture for stream msg, dms and group_pms. """ # `request` currently does not have an exported Pytest type. # TODO: Use the exported type when it's made available. @@ -634,10 +634,10 @@ def topics() -> List[str]: ], ids=[ "stream_mention__stream_wildcard", - "stream+dm_mention__no_wildcard", - "no_mention__stream+dm_wildcard", - "stream+group_mention__dm_wildcard", - "dm_mention__stream+group_wildcard", + "stream+pm_mention__no_wildcard", + "no_mention__stream+pm_wildcard", + "stream+group_mention__pm_wildcard", + "pm_mention__stream+group_wildcard", "group_mention__all_wildcard", "all_mention__stream_wildcard", "stream+group_mention__wildcard", diff --git a/tests/ui/test_ui_tools.py b/tests/ui/test_ui_tools.py index cf170a5a04..28ae866a63 100644 --- a/tests/ui/test_ui_tools.py +++ b/tests/ui/test_ui_tools.py @@ -942,8 +942,8 @@ def test_keypress_NEXT_UNREAD_TOPIC_no_stream( assert mid_col_view.controller.narrow_to_topic.called is False assert return_value == key - @pytest.mark.parametrize("key", keys_for_command("NEXT_UNREAD_PM")) - def test_keypress_NEXT_UNREAD_PM_stream( + @pytest.mark.parametrize("key", keys_for_command("NEXT_UNREAD_DM")) + def test_keypress_NEXT_UNREAD_DM_stream( self, mid_col_view, mocker, key, widget_size ): size = widget_size(mid_col_view) @@ -959,8 +959,8 @@ def test_keypress_NEXT_UNREAD_PM_stream( contextual_message_id=1, ) - @pytest.mark.parametrize("key", keys_for_command("NEXT_UNREAD_PM")) - def test_keypress_NEXT_UNREAD_PM_no_dm( + @pytest.mark.parametrize("key", keys_for_command("NEXT_UNREAD_DM")) + def test_keypress_NEXT_UNREAD_DM_no_dm( self, mid_col_view, mocker, key, widget_size ): size = widget_size(mid_col_view) @@ -1152,7 +1152,7 @@ def mock_external_classes(self, mocker): def test_menu_view(self, mocker): self.streams_view = mocker.patch(VIEWS + ".LeftColumnView.streams_view") home_button = mocker.patch(VIEWS + ".HomeButton") - dm_button = mocker.patch(VIEWS + ".PMButton") + dm_button = mocker.patch(VIEWS + ".DMButton") starred_button = mocker.patch(VIEWS + ".StarredButton") mocker.patch(VIEWS + ".urwid.ListBox") mocker.patch(VIEWS + ".urwid.SimpleFocusListWalker") diff --git a/tests/ui/test_utils.py b/tests/ui/test_utils.py index 88f0e16785..b84c01c426 100644 --- a/tests/ui/test_utils.py +++ b/tests/ui/test_utils.py @@ -13,7 +13,7 @@ @pytest.mark.parametrize( "msg, narrow, muted_streams, is_muted_topic_return_value, muted", [ - ( # PM TEST + ( # DM TEST { "type": "private", # ... diff --git a/tests/ui_tools/test_buttons.py b/tests/ui_tools/test_buttons.py index ca23b2a5e2..0e78ac3cc1 100644 --- a/tests/ui_tools/test_buttons.py +++ b/tests/ui_tools/test_buttons.py @@ -10,10 +10,10 @@ from zulipterminal.config.symbols import CHECK_MARK, MUTE_MARKER from zulipterminal.ui_tools.buttons import ( DecodedStream, + DMButton, EmojiButton, MessageLinkButton, ParsedNarrowLink, - PMButton, StarredButton, StreamButton, TopButton, @@ -179,13 +179,13 @@ def test_update_widget( set_attr_map.assert_called_once_with({None: top_button.label_style}) -class TestPMButton: +class TestDMButton: def test_button_text_length(self, mocker: MockerFixture, count: int = 10) -> None: - dm_button = PMButton(controller=mocker.Mock(), count=count) + dm_button = DMButton(controller=mocker.Mock(), count=count) assert len(dm_button.label_text) == 20 def test_button_text_title(self, mocker: MockerFixture, count: int = 10) -> None: - dm_button = PMButton(controller=mocker.Mock(), count=count) + dm_button = DMButton(controller=mocker.Mock(), count=count) title_text = dm_button.label_text[:-3].strip() assert title_text == "Direct messages" diff --git a/tests/ui_tools/test_messages.py b/tests/ui_tools/test_messages.py index f96229ec7c..5b557284c6 100644 --- a/tests/ui_tools/test_messages.py +++ b/tests/ui_tools/test_messages.py @@ -827,7 +827,7 @@ def test_main_view_renders_slash_me(self, mocker, message, content, is_me_messag ids=[ "different_stream_before", "different_topic_before", - "PM_before", + "DM_before", ], ) def test_main_view_generates_stream_header( @@ -887,7 +887,7 @@ def test_main_view_generates_stream_header( "stream_before", ], ) - def test_main_view_generates_PM_header( + def test_main_view_generates_DM_header( self, mocker, message, to_vary_in_last_message ): last_message = dict(message, **to_vary_in_last_message) @@ -1041,7 +1041,7 @@ def test_msg_generates_search_and_header_bar( assert header_bar[0].text.startswith(assert_header_bar) assert search_bar.text_to_fill == assert_search_bar - # Assume recipient (PM/stream/topic) header is unchanged below + # Assume recipient (DM/stream/topic) header is unchanged below @pytest.mark.parametrize( "message", [ diff --git a/zulipterminal/config/keys.py b/zulipterminal/config/keys.py index f86f0e2cd3..5095b6c893 100644 --- a/zulipterminal/config/keys.py +++ b/zulipterminal/config/keys.py @@ -214,7 +214,7 @@ class KeyBinding(TypedDict): 'help_text': 'View all messages', 'key_category': 'narrowing', }, - 'ALL_PM': { + 'ALL_DM': { 'keys': ['P'], 'help_text': 'View all direct messages', 'key_category': 'narrowing', @@ -234,7 +234,7 @@ class KeyBinding(TypedDict): 'help_text': 'Next unread topic', 'key_category': 'narrowing', }, - 'NEXT_UNREAD_PM': { + 'NEXT_UNREAD_DM': { 'keys': ['p'], 'help_text': 'Next unread direct message', 'key_category': 'narrowing', @@ -346,7 +346,7 @@ class KeyBinding(TypedDict): 'help_text': 'Show/hide user information', 'key_category': 'user_list', }, - 'NARROW_TO_USER_PM': { + 'NARROW_TO_USER_DM': { # Added to clarify functionality of button activation, # as opposed to opening user profile or other effects. # Implementation uses ACTIVATE_BUTTON command. diff --git a/zulipterminal/core.py b/zulipterminal/core.py index e18ebf936d..540144174f 100644 --- a/zulipterminal/core.py +++ b/zulipterminal/core.py @@ -222,7 +222,7 @@ def clamp(n: int, minn: int, maxn: int) -> int: width = clamp(max_cols, min_width, max_width) scaling = 1 - ((width - min_width) / (4 * (max_width - min_width))) max_popup_cols = int(scaling * max_cols) - # Scale Height + # Scale Height. max_popup_rows = 3 * max_rows // 4 return max_popup_cols, max_popup_rows diff --git a/zulipterminal/ui.py b/zulipterminal/ui.py index 9f8bac8871..a0fa510507 100644 --- a/zulipterminal/ui.py +++ b/zulipterminal/ui.py @@ -260,7 +260,7 @@ def keypress(self, size: urwid_Box, key: str) -> Optional[str]: elif ( is_command_key("SEARCH_MESSAGES", key) or is_command_key("NEXT_UNREAD_TOPIC", key) - or is_command_key("NEXT_UNREAD_PM", key) + or is_command_key("NEXT_UNREAD_DM", key) or is_command_key("STREAM_MESSAGE", key) or is_command_key("DIRECT_MESSAGE", key) ): @@ -269,7 +269,7 @@ def keypress(self, size: urwid_Box, key: str) -> Optional[str]: self.body.focus_col = 1 self.middle_column.keypress(size, key) return key - elif is_command_key("ALL_PM", key): + elif is_command_key("ALL_DM", key): self.dm_button.activate(key) elif is_command_key("ALL_STARRED", key): self.starred_button.activate(key) diff --git a/zulipterminal/ui_tools/boxes.py b/zulipterminal/ui_tools/boxes.py index f32b38066b..8552a7cf58 100644 --- a/zulipterminal/ui_tools/boxes.py +++ b/zulipterminal/ui_tools/boxes.py @@ -87,12 +87,12 @@ def __init__(self, view: Any) -> None: # Set to int for stream box only self.stream_id: Optional[int] - # Used in PM and stream boxes - # (empty list implies PM box empty, or not initialized) + # Used in DM and stream boxes + # (empty list implies DM box empty, or not initialized) # Prioritizes autocomplete in message body self.recipient_user_ids: List[int] - # Updates server on PM typing events + # Updates server on DM typing events # Is separate from recipient_user_ids because we # don't include the user's own id in this list self.typing_recipient_user_ids: List[int] @@ -168,7 +168,7 @@ def _set_regular_and_typing_recipient_user_ids( self.typing_recipient_user_ids = list() def send_stop_typing_status(self) -> None: - # Send 'stop' updates only for PM narrows, when there are recipients + # Send 'stop' updates only for DM narrows, when there are recipients # to send to and a prior 'start' status has already been sent. if ( self.compose_box_status == "open_with_private" diff --git a/zulipterminal/ui_tools/buttons.py b/zulipterminal/ui_tools/buttons.py index a56bb197bf..2a0e4c86db 100644 --- a/zulipterminal/ui_tools/buttons.py +++ b/zulipterminal/ui_tools/buttons.py @@ -143,9 +143,9 @@ def __init__(self, *, controller: Any, count: int) -> None: ) -class PMButton(TopButton): +class DMButton(TopButton): def __init__(self, *, controller: Any, count: int) -> None: - button_text = f"Direct messages [{primary_display_key_for_command('ALL_PM')}]" + button_text = f"Direct messages [{primary_display_key_for_command('ALL_DM')}]" super().__init__( controller=controller, diff --git a/zulipterminal/ui_tools/utils.py b/zulipterminal/ui_tools/utils.py index d055af44b7..5a3878d8d0 100644 --- a/zulipterminal/ui_tools/utils.py +++ b/zulipterminal/ui_tools/utils.py @@ -58,7 +58,7 @@ def create_msg_box_list( # The SIM114 warnings are ignored here since combining the branches would be less clear def is_muted(msg: Message, model: Any) -> bool: - # PMs cannot be muted + # DMs cannot be muted if msg["type"] == "private": # noqa: SIM114 return False # In a topic narrow diff --git a/zulipterminal/ui_tools/views.py b/zulipterminal/ui_tools/views.py index 1d4124268c..bf681ee924 100644 --- a/zulipterminal/ui_tools/views.py +++ b/zulipterminal/ui_tools/views.py @@ -46,11 +46,11 @@ from zulipterminal.server_url import near_message_url from zulipterminal.ui_tools.boxes import PanelSearchBox from zulipterminal.ui_tools.buttons import ( + DMButton, EmojiButton, HomeButton, MentionedButton, MessageLinkButton, - PMButton, StarredButton, StreamButton, TopicButton, @@ -629,7 +629,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]: topic_name=topic, ) return key - elif is_command_key("NEXT_UNREAD_PM", key): + elif is_command_key("NEXT_UNREAD_DM", key): # narrow to next unread dm dm = self.model.get_next_unread_pm() if dm is None: @@ -640,7 +640,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]: contextual_message_id=dm, ) elif is_command_key("DIRECT_MESSAGE", key): - # Create new PM message + # Create new DM message self.footer.private_box_view() self.set_focus("footer") self.footer.focus_position = 0 @@ -793,7 +793,7 @@ def menu_view(self) -> Any: self.view.home_button = HomeButton(controller=self.controller, count=count) count = self.model.unread_counts.get("all_dms", 0) - self.view.dm_button = PMButton(controller=self.controller, count=count) + self.view.dm_button = DMButton(controller=self.controller, count=count) self.view.mentioned_button = MentionedButton( controller=self.controller,