stream settings: Fix sub-unsub btn not showing on private stream creation.

This commit is contained in:
YJDave 2018-03-11 22:21:21 +05:30 committed by Tim Abbott
parent ff6d83b2f2
commit b6408a0383
2 changed files with 4 additions and 6 deletions

View File

@ -27,7 +27,7 @@ function row_for_stream_id(stream_id) {
function settings_button_for_sub(sub) {
var id = parseInt(sub.stream_id, 10);
return $(".subscription_settings[data-stream-id='" + id + "'] .subscribe-button");
return $(".subscription_settings[data-stream-id='" + id + "'] .subscribe-button").expectOne();
}
function get_row_data(row) {
@ -212,7 +212,7 @@ exports.remove_stream = function (stream_id) {
exports.update_settings_for_subscribed = function (sub) {
var button = button_for_sub(sub);
var settings_button = settings_button_for_sub(sub).removeClass("unsubscribed");
var settings_button = settings_button_for_sub(sub).removeClass("unsubscribed").show();
if (button.length !== 0) {
exports.rerender_subscribers_count(sub, true);
@ -236,7 +236,7 @@ exports.update_settings_for_subscribed = function (sub) {
exports.update_settings_for_unsubscribed = function (sub) {
var button = button_for_sub(sub);
var settings_button = settings_button_for_sub(sub).addClass("unsubscribed");
var settings_button = settings_button_for_sub(sub).addClass("unsubscribed").show();
button.toggleClass("checked");
settings_button.text(i18n.t("Subscribe"));

View File

@ -21,10 +21,8 @@
{{#if is_admin}}
<button class="button small rounded btn-danger deactivate" type="button" name="delete_button" title="{{t 'Delete stream'}}">{{t 'Delete' }} <i class="icon-vector-trash" aria-hidden="true"></i></button>
{{/if}}
{{#if should_display_subscription_button}}
<button class="button small rounded subscribe-button sub_unsub_button {{#unless subscribed }}unsubscribed{{/unless}}" type="button" name="button" title="{{t 'Toggle subscription'}} (S)">
<button class="button small rounded subscribe-button sub_unsub_button {{#unless subscribed }}unsubscribed{{/unless}}" type="button" name="button" title="{{t 'Toggle subscription'}} (S)" {{#unless should_display_subscription_button}}style="display: none"{{/unless}}>
{{#if subscribed }}{{#tr oneself }}Unsubscribe{{/tr}}{{else}}{{#tr oneself }}Subscribe{{/tr}}{{/if}}</button>
{{/if}}
{{#if invite_only}}
{{#if subscribed}}
<a href="{{preview_url}}" class="button small rounded" id="preview-stream-button" role="button" title="{{t 'View stream'}} (V)">{{t "View stream"}}</a>