Skip to content

Commit 7843292

Browse files
committed
refactor: Replace 'private' with 'direct' - rebased.
1 parent dc4d9bc commit 7843292

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def msg_template_factory(
450450
"""
451451
Generate message template for all types of messages(stream/PM/group)
452452
"""
453-
# TODO: Separate Message into distinct types for stream and private messages.
453+
# TODO: Separate Message into distinct types for stream and direct messages.
454454
message = Message(
455455
id=msg_id,
456456
sender_full_name="Foo Foo",

tests/ui_tools/test_messages.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_init_fails_with_bad_message_type(self):
7171
with pytest.raises(RuntimeError):
7272
MessageBox(message, self.model, None)
7373

74-
def test_private_message_to_self(self, mocker):
74+
def test_direct_message_to_self(self, mocker): # rebased
7575
message = dict(
7676
type="private",
7777
display_recipient=[
@@ -85,13 +85,14 @@ def test_private_message_to_self(self, mocker):
8585
)
8686
self.model.user_email = "[email protected]"
8787
mocker.patch(
88-
MODULE + ".MessageBox._is_private_message_to_self", return_value=True
88+
MODULE + ".MessageBox._is_direct_message_to_self", # rebased
89+
return_value=True,
8990
)
9091
mocker.patch.object(MessageBox, "main_view")
9192
msg_box = MessageBox(message, self.model, None)
9293

9394
assert msg_box.recipient_emails == ["[email protected]"]
94-
msg_box._is_private_message_to_self.assert_called_once_with()
95+
msg_box._is_direct_message_to_self.assert_called_once_with() # rebased
9596

9697
@pytest.mark.parametrize(
9798
"content, expected_markup",

zulipterminal/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ def get_stream_by_id(streams: List[StreamData], stream_id: int) -> StreamData:
15551555

15561556
def _handle_typing_event(self, event: Event) -> None:
15571557
"""
1558-
Handle typing notifications (in private messages)
1558+
Handle typing notifications (in direct messages)
15591559
"""
15601560
assert event["type"] == "typing"
15611561

zulipterminal/ui_tools/messages.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(self, message: Message, model: "Model", last_message: Any) -> None:
8888
raise RuntimeError("Invalid message type")
8989

9090
if self.message["type"] == "private":
91-
if self._is_private_message_to_self():
91+
if self._is_direct_message_to_self(): # rebased
9292
recipient = self.message["display_recipient"][0]
9393
self.recipients_names = recipient["full_name"]
9494
self.recipient_emails = [self.model.user_email]
@@ -146,7 +146,7 @@ def need_recipient_header(self) -> bool:
146146
else:
147147
raise RuntimeError("Invalid message type")
148148

149-
def _is_private_message_to_self(self) -> bool:
149+
def _is_direct_message_to_self(self) -> bool:
150150
recipient_list = self.message["display_recipient"]
151151
return (
152152
len(recipient_list) == 1
@@ -1017,7 +1017,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
10171017
self.model.controller.view.middle_column.set_focus("footer")
10181018
elif is_command_key("EDIT_MESSAGE", key):
10191019
# User can't edit messages of others that already have a subject
1020-
# For private messages, subject = "" (empty string)
1020+
# For direct messages, subject = "" (empty string)
10211021
# This also handles the realm_message_content_edit_limit_seconds == 0 case
10221022
if (
10231023
self.message["sender_id"] != self.model.user_id
@@ -1089,7 +1089,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
10891089
)
10901090
return key
10911091
else:
1092-
# The remaining case is of a private message not belonging to user.
1092+
# The remaining case is of a direct message not belonging to user.
10931093
# Which should be already handled by the topmost if block
10941094
raise RuntimeError(
10951095
"Reached unexpected block. This should be handled at the top."

0 commit comments

Comments
 (0)