mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +00:00
refactor: Extract can_view_subscribers().
We also remove some needless uses of the calculated field in the node tests.
This commit is contained in:
@@ -54,11 +54,10 @@ export function update_calculated_fields(sub) {
|
||||
sub.should_display_subscription_button = stream_data.can_toggle_subscription(sub);
|
||||
sub.should_display_preview_button = stream_data.can_preview(sub);
|
||||
sub.can_change_stream_permissions = stream_data.can_change_permissions(sub);
|
||||
// User can add other users to stream if stream is public or user is subscribed to stream.
|
||||
// Guest users can't access subscribers of any(public or private) non-subscribed streams.
|
||||
sub.can_access_subscribers =
|
||||
page_params.is_admin || sub.subscribed || (!page_params.is_guest && !sub.invite_only);
|
||||
sub.can_access_subscribers = stream_data.can_view_subscribers(sub);
|
||||
|
||||
sub.preview_url = hash_util.by_stream_uri(sub.stream_id);
|
||||
// User can add other users to stream if stream is public or user is subscribed to stream.
|
||||
sub.can_add_subscribers = !page_params.is_guest && (!sub.invite_only || sub.subscribed);
|
||||
sub.is_old_stream = sub.stream_weekly_traffic !== null;
|
||||
if (sub.rendered_description !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user