Skip to content

Commit 4b0afc4

Browse files
committed
refactor: Replace 'PM' with 'DM' - rebased.
1 parent 0fd4629 commit 4b0afc4

File tree

14 files changed

+40
-40
lines changed

14 files changed

+40
-40
lines changed

docs/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ through autocomplete depend upon the context automatically.
369369
* `P` (with stream color) if the stream is valid and private,
370370
* `` if the stream is invalid.
371371

372-
![PM recipients header](https://user-images.githubusercontent.com/55916430/118403345-9d422800-b68b-11eb-9005-6d2af74adab9.png)
372+
![DM recipients header](https://user-images.githubusercontent.com/55916430/118403345-9d422800-b68b-11eb-9005-6d2af74adab9.png)
373373

374374
**NOTE:** If a direct message recipient's name contains comma(s) (`,`), they
375375
are currently treated as comma-separated recipients.

tests/config/test_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def test_display_key_for_urwid_key(urwid_key: str, display_key: str) -> None:
144144
COMMAND_TO_DISPLAY_KEYS = [
145145
("NEXT_LINE", ["Down", "Ctrl n"]),
146146
("TOGGLE_STAR_STATUS", ["Ctrl s", "*"]),
147-
("ALL_PM", ["P"]),
147+
("ALL_DM", ["P"]),
148148
]
149149

150150

tests/conftest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,11 @@ def direct_message_fixture(request: Any) -> Message:
520520

521521
@pytest.fixture(
522522
params=["stream_msg_template", "dm_template", "group_dm_template"],
523-
ids=["stream_message", "dm_message", "group_dm_message"],
523+
ids=["stream_message", "pm_message", "group_pm_message"],
524524
)
525525
def message_fixture(request: Any) -> Message:
526526
"""
527-
Acts as a parametrize fixture for stream msg, dms and group_dms.
527+
Acts as a parametrize fixture for stream msg, dms and group_pms.
528528
"""
529529
# `request` currently does not have an exported Pytest type.
530530
# TODO: Use the exported type when it's made available.
@@ -634,10 +634,10 @@ def topics() -> List[str]:
634634
],
635635
ids=[
636636
"stream_mention__stream_wildcard",
637-
"stream+dm_mention__no_wildcard",
638-
"no_mention__stream+dm_wildcard",
639-
"stream+group_mention__dm_wildcard",
640-
"dm_mention__stream+group_wildcard",
637+
"stream+pm_mention__no_wildcard",
638+
"no_mention__stream+pm_wildcard",
639+
"stream+group_mention__pm_wildcard",
640+
"pm_mention__stream+group_wildcard",
641641
"group_mention__all_wildcard",
642642
"all_mention__stream_wildcard",
643643
"stream+group_mention__wildcard",
@@ -1140,7 +1140,7 @@ def index_multiple_topic_msg(
11401140
@pytest.fixture
11411141
def index_user(empty_index: Index) -> Index:
11421142
"""
1143-
Expected index of initial_data when model.narrow = [['dm_with',
1143+
Expected index of initial_data when model.narrow = [['pm_with',
11441144
11451145
"""
11461146
user_ids = frozenset({5179, 5140})
@@ -1153,7 +1153,7 @@ def index_user(empty_index: Index) -> Index:
11531153
@pytest.fixture
11541154
def index_user_multiple(empty_index: Index) -> Index:
11551155
"""
1156-
Expected index of initial_data when model.narrow = [['dm_with',
1156+
Expected index of initial_data when model.narrow = [['pm_with',
11571157
11581158
"""
11591159
user_ids = frozenset({5179, 5140, 5180})

tests/ui/test_ui_tools.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,8 @@ def test_keypress_NEXT_UNREAD_TOPIC_no_stream(
942942
assert mid_col_view.controller.narrow_to_topic.called is False
943943
assert return_value == key
944944

945-
@pytest.mark.parametrize("key", keys_for_command("NEXT_UNREAD_PM"))
946-
def test_keypress_NEXT_UNREAD_PM_stream(
945+
@pytest.mark.parametrize("key", keys_for_command("NEXT_UNREAD_DM"))
946+
def test_keypress_NEXT_UNREAD_DM_stream(
947947
self, mid_col_view, mocker, key, widget_size
948948
):
949949
size = widget_size(mid_col_view)
@@ -959,8 +959,8 @@ def test_keypress_NEXT_UNREAD_PM_stream(
959959
contextual_message_id=1,
960960
)
961961

962-
@pytest.mark.parametrize("key", keys_for_command("NEXT_UNREAD_PM"))
963-
def test_keypress_NEXT_UNREAD_PM_no_dm(
962+
@pytest.mark.parametrize("key", keys_for_command("NEXT_UNREAD_DM"))
963+
def test_keypress_NEXT_UNREAD_DM_no_dm(
964964
self, mid_col_view, mocker, key, widget_size
965965
):
966966
size = widget_size(mid_col_view)
@@ -1152,7 +1152,7 @@ def mock_external_classes(self, mocker):
11521152
def test_menu_view(self, mocker):
11531153
self.streams_view = mocker.patch(VIEWS + ".LeftColumnView.streams_view")
11541154
home_button = mocker.patch(VIEWS + ".HomeButton")
1155-
dm_button = mocker.patch(VIEWS + ".PMButton")
1155+
dm_button = mocker.patch(VIEWS + ".DMButton")
11561156
starred_button = mocker.patch(VIEWS + ".StarredButton")
11571157
mocker.patch(VIEWS + ".urwid.ListBox")
11581158
mocker.patch(VIEWS + ".urwid.SimpleFocusListWalker")

tests/ui/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@pytest.mark.parametrize(
1414
"msg, narrow, muted_streams, is_muted_topic_return_value, muted",
1515
[
16-
( # PM TEST
16+
( # DM TEST
1717
{
1818
"type": "private",
1919
# ...

tests/ui_tools/test_buttons.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
from zulipterminal.config.symbols import CHECK_MARK, MUTE_MARKER
1111
from zulipterminal.ui_tools.buttons import (
1212
DecodedStream,
13+
DMButton,
1314
EmojiButton,
1415
MessageLinkButton,
1516
ParsedNarrowLink,
16-
PMButton,
1717
StarredButton,
1818
StreamButton,
1919
TopButton,
@@ -179,13 +179,13 @@ def test_update_widget(
179179
set_attr_map.assert_called_once_with({None: top_button.label_style})
180180

181181

182-
class TestPMButton:
182+
class TestDMButton:
183183
def test_button_text_length(self, mocker: MockerFixture, count: int = 10) -> None:
184-
dm_button = PMButton(controller=mocker.Mock(), count=count)
184+
dm_button = DMButton(controller=mocker.Mock(), count=count)
185185
assert len(dm_button.label_text) == 20
186186

187187
def test_button_text_title(self, mocker: MockerFixture, count: int = 10) -> None:
188-
dm_button = PMButton(controller=mocker.Mock(), count=count)
188+
dm_button = DMButton(controller=mocker.Mock(), count=count)
189189
title_text = dm_button.label_text[:-3].strip()
190190
assert title_text == "Direct messages"
191191

tests/ui_tools/test_messages.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ def test_main_view_renders_slash_me(self, mocker, message, content, is_me_messag
827827
ids=[
828828
"different_stream_before",
829829
"different_topic_before",
830-
"PM_before",
830+
"DM_before",
831831
],
832832
)
833833
def test_main_view_generates_stream_header(
@@ -887,7 +887,7 @@ def test_main_view_generates_stream_header(
887887
"stream_before",
888888
],
889889
)
890-
def test_main_view_generates_PM_header(
890+
def test_main_view_generates_DM_header(
891891
self, mocker, message, to_vary_in_last_message
892892
):
893893
last_message = dict(message, **to_vary_in_last_message)
@@ -1041,7 +1041,7 @@ def test_msg_generates_search_and_header_bar(
10411041
assert header_bar[0].text.startswith(assert_header_bar)
10421042
assert search_bar.text_to_fill == assert_search_bar
10431043

1044-
# Assume recipient (PM/stream/topic) header is unchanged below
1044+
# Assume recipient (DM/stream/topic) header is unchanged below
10451045
@pytest.mark.parametrize(
10461046
"message",
10471047
[

zulipterminal/config/keys.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class KeyBinding(TypedDict):
214214
'help_text': 'View all messages',
215215
'key_category': 'narrowing',
216216
},
217-
'ALL_PM': {
217+
'ALL_DM': {
218218
'keys': ['P'],
219219
'help_text': 'View all direct messages',
220220
'key_category': 'narrowing',
@@ -234,7 +234,7 @@ class KeyBinding(TypedDict):
234234
'help_text': 'Next unread topic',
235235
'key_category': 'narrowing',
236236
},
237-
'NEXT_UNREAD_PM': {
237+
'NEXT_UNREAD_DM': {
238238
'keys': ['p'],
239239
'help_text': 'Next unread direct message',
240240
'key_category': 'narrowing',
@@ -346,7 +346,7 @@ class KeyBinding(TypedDict):
346346
'help_text': 'Show/hide user information',
347347
'key_category': 'user_list',
348348
},
349-
'NARROW_TO_USER_PM': {
349+
'NARROW_TO_USER_DM': {
350350
# Added to clarify functionality of button activation,
351351
# as opposed to opening user profile or other effects.
352352
# Implementation uses ACTIVATE_BUTTON command.

zulipterminal/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ def narrow_to_user(
645645
) -> None:
646646
self._narrow_to(
647647
anchor=contextual_message_id,
648-
dm_with=", ".join(recipient_emails),
648+
pm_with=", ".join(recipient_emails),
649649
)
650650

651651
def narrow_to_all_messages(

zulipterminal/ui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def keypress(self, size: urwid_Box, key: str) -> Optional[str]:
260260
elif (
261261
is_command_key("SEARCH_MESSAGES", key)
262262
or is_command_key("NEXT_UNREAD_TOPIC", key)
263-
or is_command_key("NEXT_UNREAD_PM", key)
263+
or is_command_key("NEXT_UNREAD_DM", key)
264264
or is_command_key("STREAM_MESSAGE", key)
265265
or is_command_key("DIRECT_MESSAGE", key)
266266
):
@@ -269,7 +269,7 @@ def keypress(self, size: urwid_Box, key: str) -> Optional[str]:
269269
self.body.focus_col = 1
270270
self.middle_column.keypress(size, key)
271271
return key
272-
elif is_command_key("ALL_PM", key):
272+
elif is_command_key("ALL_DM", key):
273273
self.dm_button.activate(key)
274274
elif is_command_key("ALL_STARRED", key):
275275
self.starred_button.activate(key)

0 commit comments

Comments
 (0)