mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
compose: Hide subscribe button and change text for waiting period users.
Fixes #10124. Users in the waiting period category cannot subscribe other users to a stream. When a user tries to mention another unsubscribed user, a warning message appears with a subscribe button on it to subscribe the other user. This commit removes the subscribe button and changes the warning text for users in the waiting period category.
This commit is contained in:
committed by
Tim Abbott
parent
3f019cafb2
commit
e21e8c1bae
@@ -86,6 +86,7 @@ var me = {
|
|||||||
email: 'me@example.com',
|
email: 'me@example.com',
|
||||||
user_id: 30,
|
user_id: 30,
|
||||||
full_name: 'Me Myself',
|
full_name: 'Me Myself',
|
||||||
|
date_joined: new Date(),
|
||||||
};
|
};
|
||||||
|
|
||||||
var alice = {
|
var alice = {
|
||||||
|
|||||||
@@ -534,10 +534,16 @@ run_test('compose_invite_users', () => {
|
|||||||
var args = {
|
var args = {
|
||||||
email: 'hamlet@zulip.com',
|
email: 'hamlet@zulip.com',
|
||||||
name: 'Hamlet',
|
name: 'Hamlet',
|
||||||
|
can_subscribe_other_users: true,
|
||||||
};
|
};
|
||||||
var html = render('compose-invite-users', args);
|
var html = render('compose-invite-users', args);
|
||||||
var button = $(html).find("button:first");
|
var button = $(html).find("button:first");
|
||||||
assert.equal(button.text(), "translated: Subscribe");
|
assert.equal(button.text(), "translated: Subscribe");
|
||||||
|
|
||||||
|
args.can_subscribe_other_users = false;
|
||||||
|
html = render('compose-invite-users', args);
|
||||||
|
button = $(html).find("button:first");
|
||||||
|
assert.equal(button.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test('compose_all_everyone', () => {
|
run_test('compose_all_everyone', () => {
|
||||||
|
|||||||
@@ -725,7 +725,11 @@ exports.initialize = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (existing_invites.indexOf(email) === -1) {
|
if (existing_invites.indexOf(email) === -1) {
|
||||||
var context = {email: email, name: data.mentioned.full_name};
|
var context = {
|
||||||
|
email: email,
|
||||||
|
name: data.mentioned.full_name,
|
||||||
|
can_subscribe_other_users: page_params.can_subscribe_other_users,
|
||||||
|
};
|
||||||
var new_row = templates.render("compose-invite-users", context);
|
var new_row = templates.render("compose-invite-users", context);
|
||||||
error_area.append(new_row);
|
error_area.append(new_row);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<div class="compose_invite_user" data-useremail="{{email}}">
|
<div class="compose_invite_user" data-useremail="{{email}}">
|
||||||
|
{{#if can_subscribe_other_users}}
|
||||||
<p>{{#tr this}}<strong>__name__</strong> is not subscribed to this stream. They will not be notified unless you subscribe them.{{/tr}}</p>
|
<p>{{#tr this}}<strong>__name__</strong> is not subscribed to this stream. They will not be notified unless you subscribe them.{{/tr}}</p>
|
||||||
<div class="compose_invite_user_controls">
|
<div class="compose_invite_user_controls">
|
||||||
<button class="btn btn-warning compose_invite_link" >{{t "Subscribe" }}</button><button type="button" class="compose_invite_close close">×</button>
|
<button class="btn btn-warning compose_invite_link" >{{t "Subscribe" }}</button><button type="button" class="compose_invite_close close">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<p>{{#tr this}}<strong>__name__</strong> is not subscribed to this stream. They will not be notified if you mention them.{{/tr}}</p>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ def fetch_initial_state_data(user_profile: UserProfile,
|
|||||||
)
|
)
|
||||||
|
|
||||||
state['can_create_streams'] = user_profile.can_create_streams()
|
state['can_create_streams'] = user_profile.can_create_streams()
|
||||||
|
state['can_subscribe_other_users'] = user_profile.can_subscribe_other_users()
|
||||||
state['cross_realm_bots'] = list(get_cross_realm_dicts())
|
state['cross_realm_bots'] = list(get_cross_realm_dicts())
|
||||||
state['is_admin'] = user_profile.is_realm_admin
|
state['is_admin'] = user_profile.is_realm_admin
|
||||||
state['is_guest'] = user_profile.is_guest
|
state['is_guest'] = user_profile.is_guest
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class HomeTest(ZulipTestCase):
|
|||||||
"avatar_url_medium",
|
"avatar_url_medium",
|
||||||
"bot_types",
|
"bot_types",
|
||||||
"can_create_streams",
|
"can_create_streams",
|
||||||
|
"can_subscribe_other_users",
|
||||||
"cross_realm_bots",
|
"cross_realm_bots",
|
||||||
"custom_profile_field_types",
|
"custom_profile_field_types",
|
||||||
"custom_profile_fields",
|
"custom_profile_fields",
|
||||||
|
|||||||
Reference in New Issue
Block a user