mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 00:18:12 +00:00
compose: Hide sub-btn in compose-to-unsub warning if user can't subscribe.
Hide subscription button in compose-message-to-unsubscribe-stream warning, if user can't subscribe back to stream.
This commit is contained in:
@@ -569,9 +569,12 @@ run_test('compose_announce', () => {
|
||||
});
|
||||
|
||||
run_test('compose_not_subscribed', () => {
|
||||
var html = render('compose_not_subscribed');
|
||||
var html = render('compose_not_subscribed', {should_display_sub_button: true});
|
||||
var button = $(html).find("button:first");
|
||||
assert.equal(button.text(), "translated: Subscribe");
|
||||
html = render('compose_not_subscribed', {should_display_sub_button: false});
|
||||
button = $(html).find("button:first");
|
||||
assert.equal(button.length, 0);
|
||||
});
|
||||
|
||||
run_test('compose_notification', () => {
|
||||
|
||||
@@ -471,7 +471,9 @@ exports.validation_error = function (error_type, stream_name) {
|
||||
compose_error(i18n.t("Error checking subscription"), $("#stream"));
|
||||
return false;
|
||||
case "not-subscribed":
|
||||
var new_row = templates.render("compose_not_subscribed");
|
||||
var sub = stream_data.get_sub(stream_name);
|
||||
var new_row = templates.render("compose_not_subscribed", {
|
||||
should_display_sub_button: sub.should_display_subscription_button});
|
||||
compose_not_subscribed_error(new_row, $('#stream'));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
{{/tr}}
|
||||
</p>
|
||||
<div>
|
||||
{{#if should_display_sub_button}}
|
||||
<button id="error-message-sub-button" class="btn btn-warning subscribe-button sub_unsub_button">{{t "Subscribe" }}</button><button type="button" id="compose_not_subscribed_close" class="close">×</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user