stream_data: Rename get_invite_only helper method.

Since this library is intended to primarily work by user ID, we want
to name all methods that do lookups by stream name explicitly.
This commit is contained in:
Tim Abbott 2021-11-22 15:30:21 -08:00
parent d9338a68d1
commit 3f4d66109b
4 changed files with 5 additions and 5 deletions

View File

@ -123,8 +123,8 @@ 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.get_invite_only("social"));
assert.ok(!stream_data.get_invite_only("unknown"));
assert.ok(stream_data.is_invite_only_by_stream_name("social"));
assert.ok(!stream_data.is_invite_only_by_stream_name("unknown"));
assert.equal(stream_data.get_color("social"), "red");
assert.equal(stream_data.get_color("unknown"), "#c2c2c2");

View File

@ -147,7 +147,7 @@ function populate_group_from_message_container(group, message_container) {
if (group.is_stream) {
group.background_color = stream_data.get_color(message_container.msg.stream);
group.color_class = color_class.get_css_class(group.background_color);
group.invite_only = stream_data.get_invite_only(message_container.msg.stream);
group.invite_only = stream_data.is_invite_only_by_stream_name(message_container.msg.stream);
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);

View File

@ -13,7 +13,7 @@ function update_compose_stream_icon(stream_name) {
lock_icon.hide();
streamfield.removeClass("lock-padding");
if (stream_data.get_invite_only(stream_name)) {
if (stream_data.is_invite_only_by_stream_name(stream_name)) {
lock_icon.show();
streamfield.addClass("lock-padding");
} else if (stream_data.is_web_public_by_stream_name(stream_name)) {

View File

@ -573,7 +573,7 @@ export function is_web_public(stream_id) {
return sub !== undefined && sub.is_web_public;
}
export function get_invite_only(stream_name) {
export function is_invite_only_by_stream_name(stream_name) {
const sub = get_sub(stream_name);
if (sub === undefined) {
return false;