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.

echo: Remove support for zephyr mirroring.

Varun Singh126d4fb1372f
diff --git a/web/src/echo.js b/web/src/echo.js
index d501808bf8c..f8d1772926b 100644
--- a/web/src/echo.js
+++ b/web/src/echo.js
@@ -120,24 +120,6 @@ export function build_display_recipient(message) {
const display_recipient = emails.map((email) => {
email = email.trim();
const person = people.get_by_email(email);
- if (person === undefined) {
- // For unknown users, we return a skeleton object.
- //
- // This allows us to support zephyr mirroring situations
- // where the server might dynamically create users in
- // response to messages being sent to their email address.
- //
- // TODO: It might be cleaner for the web app for such
- // dynamic user creation to happen inside a separate API
- // call when the pill is constructed, and then enforcing
- // the requirement that we have an actual user object in
- // `people.js` when sending messages.
- return {
- email,
- full_name: email,
- unknown_local_echo_user: true,
- };
- }
if (person.user_id === message.sender_id) {
sender_in_display_recipients = true;
diff --git a/web/src/message_store.ts b/web/src/message_store.ts
index 73851c71e42..9823b490cec 100644
--- a/web/src/message_store.ts
+++ b/web/src/message_store.ts
@@ -20,7 +20,6 @@ export type DisplayRecipientUser = {
full_name: string;
id: number;
is_mirror_dummy: boolean;
- unknown_local_echo_user?: boolean;
};
export type DisplayRecipient = string | DisplayRecipientUser[];
diff --git a/web/src/people.ts b/web/src/people.ts
index b0336c88678..42094f65be9 100644
--- a/web/src/people.ts
+++ b/web/src/people.ts
@@ -1526,10 +1526,6 @@ export function extract_people_from_message(message: MessageWithBooleans): void
// Add new people involved in this message to the people list
for (const person of involved_people) {
- if (person.unknown_local_echo_user) {
- continue;
- }
-
const user_id = person.id;
if (people_by_user_id_dict.has(user_id)) {
@@ -1605,10 +1601,6 @@ export function maybe_incr_recipient_count(
// Track the number of direct messages we've sent to this person
// to improve autocomplete
for (const recip of message.display_recipient) {
- if (recip.unknown_local_echo_user) {
- continue;
- }
-
const user_id = recip.id;
incr_recipient_count(user_id);
}
diff --git a/web/tests/echo.test.js b/web/tests/echo.test.js
index 55c8e15d867..7874dc6338a 100644
--- a/web/tests/echo.test.js
+++ b/web/tests/echo.test.js
@@ -217,13 +217,13 @@ run_test("build_display_recipient", () => {
message = {
type: "private",
- private_message_recipient: "[email protected],[email protected]",
+ private_message_recipient: "[email protected]",
sender_email: "[email protected]",
sender_full_name: "Iago",
sender_id: 123,
};
display_recipient = echo.build_display_recipient(message);
- assert.equal(display_recipient.length, 3);
+ assert.equal(display_recipient.length, 2);
let iago = display_recipient.find((recipient) => recipient.email === "[email protected]");
assert.equal(iago.full_name, "Iago");
@@ -235,11 +235,6 @@ run_test("build_display_recipient", () => {
assert.equal(cordelia.full_name, "Cordelia");
assert.equal(cordelia.id, 21);
- const hamlet = display_recipient.find((recipient) => recipient.email === "[email protected]");
- assert.equal(hamlet.full_name, "[email protected]");
- assert.equal(hamlet.id, undefined);
- assert.equal(hamlet.unknown_local_echo_user, true);
-
message = {
type: "private",
private_message_recipient: "[email protected]",
@@ -341,7 +336,7 @@ run_test("insert_local_message direct message", ({override}) => {
let insert_message_called = false;
const insert_new_messages = ([message]) => {
- assert.equal(message.display_recipient.length, 3);
+ assert.equal(message.display_recipient.length, 2);
insert_message_called = true;
return [message];
};
@@ -351,7 +346,7 @@ run_test("insert_local_message direct message", ({override}) => {
});
const message_request = {
- private_message_recipient: "[email protected],[email protected]",
+ private_message_recipient: "[email protected]",
type: "private",
sender_email: "[email protected]",
sender_full_name: "Iago",
diff --git a/web/tests/people.test.js b/web/tests/people.test.js
index 340baf7fb00..6df410b2905 100644
--- a/web/tests/people.test.js
+++ b/web/tests/people.test.js
@@ -282,14 +282,6 @@ const stewie = {
},
};
-// This is for error checking--never actually
-// tell people.js about this user.
-const invalid_user = {
- email: "[email protected]",
- user_id: 999,
- unknown_local_echo_user: true,
-};
-
function get_all_persons() {
return people.filter_all_persons(() => true);
}
@@ -1012,7 +1004,7 @@ test_people("message_methods", () => {
});
test_people("extract_people_from_message", () => {
- let message = {
+ const message = {
type: "stream",
sender_full_name: maria.full_name,
sender_id: maria.user_id,
@@ -1024,13 +1016,6 @@ test_people("extract_people_from_message", () => {
people.extract_people_from_message(message);
assert.ok(people.is_known_user_id(maria.user_id));
blueslip.reset();
-
- // Get line coverage
- message = {
- type: "private",
- display_recipient: [invalid_user],
- };
- people.extract_people_from_message(message);
});
test_people("maybe_incr_recipient_count", () => {
@@ -1058,20 +1043,6 @@ test_people("maybe_incr_recipient_count", () => {
people.maybe_incr_recipient_count(message);
assert.equal(people.get_recipient_count(maria), 1);
- const other_invalid_recip = {
- email: "[email protected]",
- id: 500,
- unknown_local_echo_user: true,
- };
-
- message = {
- type: "private",
- sent_by_me: true,
- display_recipient: [other_invalid_recip],
- };
- people.maybe_incr_recipient_count(message);
- assert.equal(people.get_recipient_count(maria), 1);
-
message = {
type: "stream",
};