Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

drafts: Handle drafts with inaccessible users.

Sahil Batracd94837d6bff
diff --git a/web/src/drafts.js b/web/src/drafts.js
index 0213d612b03..6bcca2842a7 100644
--- a/web/src/drafts.js
+++ b/web/src/drafts.js
@@ -207,9 +207,12 @@ export function restore_message(draft) {
content: draft.content,
};
} else {
+ const recipient_emails = draft.private_message_recipient
+ .split(",")
+ .filter((email) => people.is_valid_email_for_compose(email));
compose_args = {
type: draft.type,
- private_message_recipient: draft.private_message_recipient,
+ private_message_recipient: recipient_emails.join(","),
content: draft.content,
};
}
diff --git a/web/src/people.ts b/web/src/people.ts
index 5ba049f91e1..6016d69f4b6 100644
--- a/web/src/people.ts
+++ b/web/src/people.ts
@@ -364,7 +364,7 @@ export function emails_to_full_names_string(emails: string[]): string {
if (person !== undefined) {
return person.full_name;
}
- return email;
+ return INACCESSIBLE_USER_NAME;
})
.join(", ");
}
diff --git a/web/tests/people.test.js b/web/tests/people.test.js
index e37928dd406..7a41161ef8a 100644
--- a/web/tests/people.test.js
+++ b/web/tests/people.test.js
@@ -812,7 +812,7 @@ test_people("emails_to_full_names_string", () => {
maria.email,
]),
- `${charles.full_name}, [email protected], ${maria.full_name}`,
+ `${charles.full_name}, translated: Unknown user, ${maria.full_name}`,
);
});