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.

typescript: Convert some && constructions to optional chains.

evykassirer808c24aef2ba
diff --git a/web/src/message_list.ts b/web/src/message_list.ts
index 78604f489ab..ab60d4d519f 100644
--- a/web/src/message_list.ts
+++ b/web/src/message_list.ts
@@ -428,8 +428,8 @@ export class MessageList {
let deactivated = false;
let just_unsubscribed = false;
const subscribed = stream_data.is_subscribed(stream_id);
- const invite_only = sub && sub.invite_only;
- const is_web_public = sub && sub.is_web_public;
+ const invite_only = sub?.invite_only;
+ const is_web_public = sub?.is_web_public;
const can_toggle_subscription =
sub !== undefined && stream_data.can_toggle_subscription(sub);
if (sub === undefined) {
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index 07645a1eee6..71d071a40ba 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -323,7 +323,7 @@ function render_user_stream_list(streams: StreamSubscription[], user: User): voi
filter: {
$element: $("#user-profile-streams-tab .stream-search"),
predicate(item, value) {
- return item && item.name.toLocaleLowerCase().includes(value);
+ return item?.name.toLocaleLowerCase().includes(value);
},
onupdate() {
if ($container.find(".empty-table-message").length) {