Skip to content

Commit 81b1e72

Browse files
sreecharan7neiljp
authored andcommitted
api_types/model/boxes: Add read_by_sender when sending messages.
This was added in ZFL 236 (Zulip 8.0). Tests updated. Fixes #1456.
1 parent 107fa9b commit 81b1e72

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

tests/model/test_model.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ def test_send_private_message(
773773

774774
result = model.send_private_message(recipients, content)
775775

776-
req = dict(type="private", to=recipients, content=content)
776+
req = dict(type="private", to=recipients, content=content, read_by_sender=True)
777777
self.client.send_message.assert_called_once_with(req)
778778

779779
assert result == return_value
@@ -810,7 +810,13 @@ def test_send_stream_message(
810810

811811
result = model.send_stream_message(stream, topic, content)
812812

813-
req = dict(type="stream", to=stream, subject=topic, content=content)
813+
req = dict(
814+
type="stream",
815+
to=stream,
816+
subject=topic,
817+
content=content,
818+
read_by_sender=True,
819+
)
814820
self.client.send_message.assert_called_once_with(req)
815821

816822
assert result == return_value

zulipterminal/api_types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ class PrivateComposition(TypedDict):
9393
type: DirectMessageString
9494
content: str
9595
to: List[int] # User ids
96+
read_by_sender: bool # New in ZFL 236, Zulip 8.0
9697

9798

9899
class StreamComposition(TypedDict):
99100
type: StreamMessageString
100101
content: str
101102
to: str # stream name # TODO: Migrate to using int (stream id)
102103
subject: str # TODO: Migrate to using topic
104+
read_by_sender: bool # New in ZFL 236, Zulip 8.0
103105

104106

105107
Composition = Union[PrivateComposition, StreamComposition]

zulipterminal/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ def send_private_message(self, recipients: List[int], content: str) -> bool:
541541
type="private",
542542
to=recipients,
543543
content=content,
544+
read_by_sender=True,
544545
)
545546
response = self.client.send_message(composition)
546547
display_error_if_present(response, self.controller)
@@ -557,6 +558,7 @@ def send_stream_message(self, stream: str, topic: str, content: str) -> bool:
557558
to=stream,
558559
subject=topic,
559560
content=content,
561+
read_by_sender=True,
560562
)
561563
response = self.client.send_message(composition)
562564
display_error_if_present(response, self.controller)

zulipterminal/ui_tools/boxes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,13 +820,15 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
820820
type="private",
821821
to=self.recipient_user_ids,
822822
content=self.msg_write_box.edit_text,
823+
read_by_sender=True,
823824
)
824825
elif self.compose_box_status == "open_with_stream":
825826
this_draft = StreamComposition(
826827
type="stream",
827828
to=self.stream_write_box.edit_text,
828829
content=self.msg_write_box.edit_text,
829830
subject=self.title_write_box.edit_text,
831+
read_by_sender=True,
830832
)
831833
saved_draft = self.model.session_draft_message()
832834
if not saved_draft:

0 commit comments

Comments
 (0)