Skip to content

Commit 13b545f

Browse files
committed
refactor: Replace 'private' with 'direct' - rebased.
1 parent d88adae commit 13b545f

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
@@ -1556,7 +1556,7 @@ def get_stream_by_id(streams: List[StreamData], stream_id: int) -> StreamData:
15561556

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

zulipterminal/ui_tools/messages.py

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

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

150-
def _is_private_message_to_self(self) -> bool:
150+
def _is_direct_message_to_self(self) -> bool:
151151
recipient_list = self.message["display_recipient"]
152152
return (
153153
len(recipient_list) == 1
@@ -1043,7 +1043,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
10431043
self.model.controller.view.middle_column.set_focus("footer")
10441044
elif is_command_key("EDIT_MESSAGE", key):
10451045
# User can't edit messages of others that already have a subject
1046-
# For private messages, subject = "" (empty string)
1046+
# For direct messages, subject = "" (empty string)
10471047
# This also handles the realm_message_content_edit_limit_seconds == 0 case
10481048
if (
10491049
self.message["sender_id"] != self.model.user_id
@@ -1115,7 +1115,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
11151115
)
11161116
return key
11171117
else:
1118-
# The remaining case is of a private message not belonging to user.
1118+
# The remaining case is of a direct message not belonging to user.
11191119
# Which should be already handled by the topmost if block
11201120
raise RuntimeError(
11211121
"Reached unexpected block. This should be handled at the top."

0 commit comments

Comments
 (0)