streams: Remove now-obsolete can_make_public and can_make_private.

Now that we've moved it into a bulleted set of options inside a modal,
there's no good reason to have separate variables for the corner cases
around who can manage a stream.
This commit is contained in:
Tim Abbott
2018-05-21 16:12:50 -07:00
parent 9c8865ba76
commit 9df3480263
4 changed files with 7 additions and 17 deletions

View File

@@ -328,8 +328,7 @@ run_test('admin_options', () => {
var sub = make_sub();
stream_data.update_calculated_fields(sub);
assert(!sub.is_admin);
assert(!sub.can_make_public);
assert(!sub.can_make_private);
assert(!sub.can_change_subscription_type);
// just a sanity check that we leave "normal" fields alone
assert.equal(sub.color, 'blue');
@@ -341,8 +340,7 @@ run_test('admin_options', () => {
sub = make_sub();
stream_data.update_calculated_fields(sub);
assert(sub.is_admin);
assert(!sub.can_make_public);
assert(sub.can_make_private);
assert(sub.can_change_subscription_type);
// admins can only make private streams become public
// if they are subscribed
@@ -351,16 +349,14 @@ run_test('admin_options', () => {
sub.subscribed = false;
stream_data.update_calculated_fields(sub);
assert(sub.is_admin);
assert(!sub.can_make_public);
assert(!sub.can_make_private);
assert(!sub.can_change_subscription_type);
sub = make_sub();
sub.invite_only = true;
sub.subscribed = true;
stream_data.update_calculated_fields(sub);
assert(sub.is_admin);
assert(sub.can_make_public);
assert(!sub.can_make_private);
assert(sub.can_change_subscription_type);
});
run_test('stream_settings', () => {

View File

@@ -1224,8 +1224,6 @@ run_test('handlebars_bug', () => {
render_subscribers: true,
color: 'purple',
invite_only: true,
can_make_public: true,
can_make_private: true, /* not logical, but that's ok */
can_change_subscription_type: true,
email_address: 'xxxxxxxxxxxxxxx@zulip.com',
stream_id: 888,
@@ -1239,7 +1237,6 @@ run_test('handlebars_bug', () => {
assert(div.text().indexOf('invite-only stream') > 0);
var anchor = $(html).find(".change-stream-privacy:first");
assert.equal(anchor.data("is-private"), true);
assert.equal(anchor.text(), "[translated: Change]");
}());
@@ -1273,8 +1270,6 @@ run_test('handlebars_bug', () => {
render_subscribers: true,
color: 'purple',
invite_only: true,
can_make_public: true,
can_make_private: true, /* not logical, but that's ok */
email_address: 'xxxxxxxxxxxxxxx@zulip.com',
stream_id: 888,
in_home_view: true,

View File

@@ -206,9 +206,8 @@ exports.update_calculated_fields = function (sub) {
sub.should_display_subscription_button = !sub.invite_only || sub.subscribed;
sub.should_display_preview_button = sub.subscribed || !sub.invite_only ||
sub.previously_subscribed;
sub.can_make_public = page_params.is_admin && sub.invite_only && sub.subscribed;
sub.can_make_private = page_params.is_admin && !sub.invite_only;
sub.can_change_subscription_type = sub.can_make_public || sub.can_make_private;
sub.can_change_subscription_type = page_params.is_admin && (
!sub.invite_only || sub.subscribed);
// User can add other users to stream if stream is public or user is subscribed to stream.
sub.can_access_subscribers = !sub.invite_only || sub.subscribed || page_params.is_admin;
sub.preview_url = narrow.by_stream_uri(sub.name);

View File

@@ -38,7 +38,7 @@
{{partial "subscription_type"}}
</div>
{{#if can_change_subscription_type}}
<a class="change-stream-privacy" data-is-private="{{#if can_make_public }}true{{else}}false{{/if}}">[{{t "Change" }}]</a>
<a class="change-stream-privacy">[{{t "Change" }}]</a>
{{/if}}
</div>
<div class="regular_subscription_settings collapse {{#subscribed}}in{{/subscribed}}">