Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable cycling to recipients when editing PM #1504

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
refactor: boxes: Extract method update_recipients_from_user_ids.
This helper method to build the recipient list will also be needed in
the upcoming change.

Co-authored-by: zormit <[email protected]>
Subhasish-Behera and zormit committed May 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 4921b982492e1a6d75583db53503d2e1ff7b15f2
18 changes: 11 additions & 7 deletions zulipterminal/ui_tools/boxes.py
Original file line number Diff line number Diff line change
@@ -202,18 +202,16 @@ def _setup_common_private_compose(self) -> None:
]
self.focus_position = self.FOCUS_CONTAINER_MESSAGE

def private_box_view(
self,
*,
recipient_user_ids: Optional[List[int]] = None,
) -> None:
def update_recipients_from_user_ids(
self, recipient_user_ids: Optional[List[int]] = None
) -> str:
if recipient_user_ids:
self._set_regular_and_typing_recipient_user_ids(recipient_user_ids)
self.recipient_emails = [
self.model.user_id_email_dict[user_id]
for user_id in self.recipient_user_ids
]
recipient_info = ", ".join(
return ", ".join(
[
f"{self.model.user_dict[email]['full_name']} <{email}>"
for email in self.recipient_emails
@@ -222,9 +220,15 @@ def private_box_view(
else:
self._set_regular_and_typing_recipient_user_ids(None)
self.recipient_emails = []
recipient_info = ""
return ""

def private_box_view(
self,
*,
recipient_user_ids: Optional[List[int]] = None,
) -> None:
self.send_next_typing_update = datetime.now()
recipient_info = self.update_recipients_from_user_ids(recipient_user_ids)
self.to_write_box = ReadlineEdit("To: ", edit_text=recipient_info)
self.to_write_box.enable_autocomplete(
func=self._to_box_autocomplete,