Skip to content

Commit

Permalink
stream_data: Rename sub.is_admin to sub.is_realm_admin.
Browse files Browse the repository at this point in the history
This commit renames sub.is_admin to sub.is_realm_admin such that
we can clearly differentiate between realm and stream admins.
  • Loading branch information
sahil839 authored and timabbott committed Sep 15, 2020
1 parent 9c3341a commit ab90abf
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions frontend_tests/node_tests/stream_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ run_test("admin_options", () => {
global.page_params.is_admin = false;
let sub = make_sub();
stream_data.update_calculated_fields(sub);
assert(!sub.is_admin);
assert(!sub.is_realm_admin);
assert(!sub.can_change_stream_permissions);

// just a sanity check that we leave "normal" fields alone
Expand All @@ -437,7 +437,7 @@ run_test("admin_options", () => {
// admins can make public streams become private
sub = make_sub();
stream_data.update_calculated_fields(sub);
assert(sub.is_admin);
assert(sub.is_realm_admin);
assert(sub.can_change_stream_permissions);

// admins can only make private streams become public
Expand All @@ -446,14 +446,14 @@ run_test("admin_options", () => {
sub.invite_only = true;
sub.subscribed = false;
stream_data.update_calculated_fields(sub);
assert(sub.is_admin);
assert(sub.is_realm_admin);
assert(!sub.can_change_stream_permissions);

sub = make_sub();
sub.invite_only = true;
sub.subscribed = true;
stream_data.update_calculated_fields(sub);
assert(sub.is_admin);
assert(sub.is_realm_admin);
assert(sub.can_change_stream_permissions);
});

Expand Down
2 changes: 1 addition & 1 deletion static/js/stream_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ exports.receives_notifications = function (stream_id, notification_name) {
};

exports.update_calculated_fields = function (sub) {
sub.is_admin = page_params.is_admin;
sub.is_realm_admin = page_params.is_admin;
// Admin can change any stream's name & description either stream is public or
// private, subscribed or unsubscribed.
sub.can_change_name_description = page_params.is_admin;
Expand Down
2 changes: 1 addition & 1 deletion static/js/stream_popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function build_topic_popover(opts) {
topic_name,
can_mute_topic,
can_unmute_topic,
is_admin: sub.is_admin,
is_realm_admin: sub.is_realm_admin,
color: sub.color,
});

Expand Down
2 changes: 1 addition & 1 deletion static/templates/subscription_settings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{/if}}
</div>
<div class="button-group">
{{#if is_admin}}
{{#if is_realm_admin}}
<button class="button small rounded btn-danger deactivate" type="button" name="delete_button" title="{{t 'Delete stream'}}"> <i class="fa fa-trash-o" aria-hidden="true"></i></button>
{{/if}}
<div class="sub_unsub_button_wrapper inline-block">
Expand Down
4 changes: 2 additions & 2 deletions static/templates/topic_sidebar_actions.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</a>
</li>

{{#if is_admin}}
{{#if is_realm_admin}}

<div class="admin-separator">{{#tr this}}ADMIN ACTIONS{{/tr}}</div>

Expand All @@ -53,7 +53,7 @@
</li>
{{/if}}

{{#if is_admin}}
{{#if is_realm_admin}}
<li>
<a tabindex="0" class="sidebar-popover-move-topic-messages" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
<i class="fa fa-arrows" aria-hidden="true"></i>
Expand Down

0 comments on commit ab90abf

Please sign in to comment.