stream_data: Add web_public as a stream privacy mode.

Show web_public descriptions for web public streams.

(Temporarily limited to development environments, since this feature
is not available yet).
This commit is contained in:
Aman Agrawal
2021-05-20 11:02:00 +00:00
committed by Tim Abbott
parent 354491d037
commit 7c8e19758a
2 changed files with 37 additions and 0 deletions

View File

@@ -129,6 +129,17 @@ export const stream_privacy_policy_values = {
},
};
if (page_params.development_environment) {
stream_privacy_policy_values.web_public = {
code: "web-public",
name: $t({defaultMessage: "Web public"}),
description: $t({
defaultMessage:
"Anyone can join; anyone on the Internet can view complete message history without creating an account",
}),
};
}
export const stream_post_policy_values = {
everyone: {
code: 1,
@@ -544,6 +555,9 @@ export function id_is_subscribed(stream_id) {
export function get_stream_privacy_policy(stream_id) {
const sub = sub_store.get(stream_id);
if (sub.is_web_public) {
return stream_privacy_policy_values.web_public.code;
}
if (!sub.invite_only) {
return stream_privacy_policy_values.public.code;
}
@@ -553,6 +567,11 @@ export function get_stream_privacy_policy(stream_id) {
return stream_privacy_policy_values.private_with_public_history.code;
}
export function is_web_public(stream_id) {
const sub = sub_store.get(stream_id);
return sub !== undefined && sub.is_web_public;
}
export function get_invite_only(stream_name) {
const sub = get_sub(stream_name);
if (sub === undefined) {