Skip to content

Commit 0fd4629

Browse files
committed
refactor: Replace 'pm_' with 'dm_' - rebased.
1 parent 84e1bfe commit 0fd4629

File tree

15 files changed

+46
-46
lines changed

15 files changed

+46
-46
lines changed

docs/developer-feature-tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ To check for the above conditions, we create a function in `ui.py`:
115115
def handle_typing_event(self, event: Dict['str', Any]) -> None:
116116
# If the user is in dm narrow with the person typing
117117
if len(self.model.narrow) == 1 and\
118-
self.model.narrow[0][0] == 'pm_with' and\
118+
self.model.narrow[0][0] == 'dm_with' and\
119119
event['sender']['email'] in self.model.narrow[0][1].split(','):
120120
if event['op'] == 'start':
121121
user = self.model.user_dict[event['sender']['email']]

tests/conftest.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ def extra_stream_msg_template() -> Message:
500500

501501

502502
@pytest.fixture
503-
def pm_template() -> Message:
503+
def dm_template() -> Message:
504504
recipients = display_recipient_factory([(5179, "Boo Boo"), (5140, "Foo Foo")])
505505
return msg_template_factory(537287, "private", 1520918736, recipients=recipients)
506506

@@ -513,18 +513,18 @@ def group_dm_template() -> Message:
513513
return msg_template_factory(537288, "private", 1520918737, recipients=recipients)
514514

515515

516-
@pytest.fixture(params=["pm_template", "group_dm_template"])
516+
@pytest.fixture(params=["dm_template", "group_dm_template"])
517517
def direct_message_fixture(request: Any) -> Message:
518518
return request.getfixturevalue(request.param)
519519

520520

521521
@pytest.fixture(
522-
params=["stream_msg_template", "pm_template", "group_dm_template"],
523-
ids=["stream_message", "pm_message", "group_pm_message"],
522+
params=["stream_msg_template", "dm_template", "group_dm_template"],
523+
ids=["stream_message", "dm_message", "group_dm_message"],
524524
)
525525
def message_fixture(request: Any) -> Message:
526526
"""
527-
Acts as a parametrize fixture for stream msg, dms and group_pms.
527+
Acts as a parametrize fixture for stream msg, dms and group_dms.
528528
"""
529529
# `request` currently does not have an exported Pytest type.
530530
# TODO: Use the exported type when it's made available.
@@ -535,7 +535,7 @@ def message_fixture(request: Any) -> Message:
535535
@pytest.fixture
536536
def messages_successful_response(
537537
stream_msg_template: Message,
538-
pm_template: Message,
538+
dm_template: Message,
539539
group_dm_template: Message,
540540
) -> Dict[str, Any]:
541541
"""
@@ -546,7 +546,7 @@ def messages_successful_response(
546546
"anchor": 10000000000000000,
547547
"messages": [
548548
stream_msg_template,
549-
pm_template,
549+
dm_template,
550550
group_dm_template,
551551
],
552552
"result": "success",
@@ -634,10 +634,10 @@ def topics() -> List[str]:
634634
],
635635
ids=[
636636
"stream_mention__stream_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",
637+
"stream+dm_mention__no_wildcard",
638+
"no_mention__stream+dm_wildcard",
639+
"stream+group_mention__dm_wildcard",
640+
"dm_mention__stream+group_wildcard",
641641
"group_mention__all_wildcard",
642642
"all_mention__stream_wildcard",
643643
"stream+group_mention__wildcard",
@@ -1060,7 +1060,7 @@ def initial_index() -> Index:
10601060

10611061
@pytest.fixture
10621062
def empty_index(
1063-
stream_msg_template: Message, pm_template: Message, group_dm_template: Message
1063+
stream_msg_template: Message, dm_template: Message, group_dm_template: Message
10641064
) -> Index:
10651065
return deepcopy(
10661066
Index(
@@ -1079,7 +1079,7 @@ def empty_index(
10791079
lambda: {},
10801080
{
10811081
stream_msg_template["id"]: stream_msg_template,
1082-
pm_template["id"]: pm_template,
1082+
dm_template["id"]: dm_template,
10831083
group_dm_template["id"]: group_dm_template,
10841084
},
10851085
),
@@ -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 = [['pm_with',
1143+
Expected index of initial_data when model.narrow = [['dm_with',
11441144
'boo@zulip.com'],
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 = [['pm_with',
1156+
Expected index of initial_data when model.narrow = [['dm_with',
11571157
'boo@zulip.com, bar@zulip.com'],
11581158
"""
11591159
user_ids = frozenset({5179, 5140, 5180})

tests/core/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def test_stream_muting_confirmation_popup(
514514
"Default_all_msg_search",
515515
"redo_default_search",
516516
"search_within_stream",
517-
"pm_search_again",
517+
"dm_search_again",
518518
"search_within_topic_narrow",
519519
],
520520
)

tests/model/test_model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ def test_is_search_narrow(self, model, narrow, is_search_narrow):
406406
"bad_args",
407407
[
408408
dict(topic="some topic"),
409-
dict(stream="foo", pm_with="someone"),
410-
dict(topic="blah", pm_with="someone"),
411-
dict(pm_with="someone", topic="foo"),
409+
dict(stream="foo", dm_with="someone"),
410+
dict(topic="blah", dm_with="someone"),
411+
dict(dm_with="someone", topic="foo"),
412412
],
413413
)
414414
def test_set_narrow_bad_input(self, model, bad_args):
@@ -427,7 +427,7 @@ def test_set_narrow_bad_input(self, model, bad_args):
427427
([["is", "starred"]], dict(starred=True)),
428428
([["is", "mentioned"]], dict(mentioned=True)),
429429
([["is", "private"]], dict(pms=True)),
430-
([["pm-with", "FOO@zulip.com"]], dict(pm_with="FOO@zulip.com")),
430+
([["pm-with", "FOO@zulip.com"]], dict(dm_with="FOO@zulip.com")),
431431
],
432432
)
433433
def test_set_narrow_already_set(self, model, narrow, good_args):
@@ -448,7 +448,7 @@ def test_set_narrow_already_set(self, model, narrow, good_args):
448448
([], [["is", "starred"]], dict(starred=True)),
449449
([], [["is", "mentioned"]], dict(mentioned=True)),
450450
([], [["is", "private"]], dict(pms=True)),
451-
([], [["pm-with", "FOOBOO@gmail.com"]], dict(pm_with="FOOBOO@gmail.com")),
451+
([], [["pm-with", "FOOBOO@gmail.com"]], dict(dm_with="FOOBOO@gmail.com")),
452452
],
453453
)
454454
def test_set_narrow_not_already_set(

tests/ui/test_ui_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
pm_button = mocker.patch(VIEWS + ".PMButton")
1155+
dm_button = mocker.patch(VIEWS + ".PMButton")
11561156
starred_button = mocker.patch(VIEWS + ".StarredButton")
11571157
mocker.patch(VIEWS + ".urwid.ListBox")
11581158
mocker.patch(VIEWS + ".urwid.SimpleFocusListWalker")
@@ -1161,7 +1161,7 @@ def test_menu_view(self, mocker):
11611161
home_button.assert_called_once_with(
11621162
controller=left_col_view.controller, count=2
11631163
)
1164-
pm_button.assert_called_once_with(controller=left_col_view.controller, count=0)
1164+
dm_button.assert_called_once_with(controller=left_col_view.controller, count=0)
11651165
starred_button.assert_called_once_with(
11661166
controller=left_col_view.controller, count=3
11671167
)

tests/ui_tools/test_boxes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def test_generic_autocomplete_stream_and_topic(
186186
([1001], False, []),
187187
([1001, 11], True, [11]),
188188
],
189-
ids=["pm_only_with_oneself", "group_pm"],
189+
ids=["dm_only_with_oneself", "group_dm"],
190190
)
191191
def test_not_calling_typing_method_to_oneself(
192192
self,

tests/ui_tools/test_buttons.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ def test_update_widget(
181181

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

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

192192

tests/ui_tools/test_messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ def test_main_view_generates_stream_header(
883883
{"type": "stream"},
884884
],
885885
ids=[
886-
"larger_pm_group",
886+
"larger_dm_group",
887887
"stream_before",
888888
],
889889
)

tests/ui_tools/test_popups.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,8 @@ def test_keypress_any_key(
10231023
],
10241024
ids=[
10251025
"stream_message_id",
1026-
"pm_message_id",
1027-
"group_pm_message_id",
1026+
"dm_message_id",
1027+
"group_dm_message_id",
10281028
],
10291029
)
10301030
def test_keypress_edit_history(

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-
pm_with=", ".join(recipient_emails),
648+
dm_with=", ".join(recipient_emails),
649649
)
650650

651651
def narrow_to_all_messages(

0 commit comments

Comments
 (0)