Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
util: Rewrite same_recipents to not use switch.
Priyank Patel1e94f6ac966b
diff --git a/static/js/util.js b/static/js/util.jsindex 63cc2ad2fff..82026568b9c 100644--- a/static/js/util.js+++ b/static/js/util.js@@ -58,21 +58,16 @@ export const same_recipient = function util_same_recipient(a, b) {if (a === undefined || b === undefined) {return false;}- if (a.type !== b.type) {- return false;- }- switch (a.type) {- case "private":- if (a.to_user_ids === undefined) {- return false;- }- return a.to_user_ids === b.to_user_ids;- case "stream":- return same_stream_and_topic(a, b);+ if (a.type === "private" && b.type === "private") {+ if (a.to_user_ids === undefined) {+ return false;+ }+ return a.to_user_ids === b.to_user_ids;+ } else if (a.type === "stream" && b.type === "stream") {+ return same_stream_and_topic(a, b);}- // should never get herereturn false;};