diff --git a/web/src/message_list_view.js b/web/src/message_list_view.js index 8bb514bba7..0350436d09 100644 --- a/web/src/message_list_view.js +++ b/web/src/message_list_view.js @@ -190,7 +190,9 @@ function populate_group_from_message_container(group, message_container) { const color = stream_data.get_color(message_container.msg.stream_id); group.recipient_bar_color = stream_color.get_recipient_bar_color(color); group.stream_privacy_icon_color = stream_color.get_stream_privacy_icon_color(color); - group.invite_only = stream_data.is_invite_only_by_stream_name(message_container.msg.stream); + group.invite_only = stream_data.is_invite_only_by_stream_id( + message_container.msg.stream_id, + ); group.is_web_public = stream_data.is_web_public(message_container.msg.stream_id); group.topic = message_container.msg.topic; group.match_topic = util.get_match_topic(message_container.msg); diff --git a/web/src/stream_data.ts b/web/src/stream_data.ts index 5db4d0914f..877c8d9fa8 100644 --- a/web/src/stream_data.ts +++ b/web/src/stream_data.ts @@ -679,8 +679,8 @@ export function is_web_public(stream_id: number): boolean { return sub ? sub.is_web_public : false; } -export function is_invite_only_by_stream_name(stream_name: string): boolean { - const sub = get_sub(stream_name); +export function is_invite_only_by_stream_id(stream_id: number): boolean { + const sub = get_sub_by_id(stream_id); if (sub === undefined) { return false; } diff --git a/web/tests/stream_data.test.js b/web/tests/stream_data.test.js index 7b7ad4b869..2032aae681 100644 --- a/web/tests/stream_data.test.js +++ b/web/tests/stream_data.test.js @@ -133,8 +133,9 @@ test("basics", () => { assert.ok(!stream_data.is_web_public_by_stream_name(social.name)); assert.ok(!stream_data.is_web_public_by_stream_name("unknown")); - assert.ok(stream_data.is_invite_only_by_stream_name("social")); - assert.ok(!stream_data.is_invite_only_by_stream_name("unknown")); + assert.ok(stream_data.is_invite_only_by_stream_id(social.stream_id)); + // Unknown stream id + assert.ok(!stream_data.is_invite_only_by_stream_id(1000)); assert.equal(stream_data.get_color(social.stream_id), "red"); assert.equal(stream_data.get_color(""), "#c2c2c2");