mirror of https://github.com/zulip/zulip.git
status: Add user menu options to set/revoke away status.
This commit is contained in:
parent
6507804637
commit
cb691694d1
|
@ -143,6 +143,8 @@ run_test('sender_hover', () => {
|
||||||
|
|
||||||
case 'user_info_popover_content':
|
case 'user_info_popover_content':
|
||||||
assert.deepEqual(opts, {
|
assert.deepEqual(opts, {
|
||||||
|
can_set_away: false,
|
||||||
|
can_revoke_away: false,
|
||||||
user_full_name: 'Alice Smith',
|
user_full_name: 'Alice Smith',
|
||||||
user_email: 'alice@example.com',
|
user_email: 'alice@example.com',
|
||||||
user_id: 42,
|
user_id: 42,
|
||||||
|
|
|
@ -114,10 +114,25 @@ function calculate_info_popover_placement(size, elt) {
|
||||||
|
|
||||||
function render_user_info_popover(user, popover_element, is_sender_popover, private_msg_class,
|
function render_user_info_popover(user, popover_element, is_sender_popover, private_msg_class,
|
||||||
template_class, popover_placement) {
|
template_class, popover_placement) {
|
||||||
|
var is_me = people.is_my_user_id(user.user_id);
|
||||||
|
|
||||||
|
var can_set_away = false;
|
||||||
|
var can_revoke_away = false;
|
||||||
|
|
||||||
|
if (is_me) {
|
||||||
|
if (user_status.is_away(user.user_id)) {
|
||||||
|
can_revoke_away = true;
|
||||||
|
} else {
|
||||||
|
can_set_away = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var args = {
|
var args = {
|
||||||
|
can_revoke_away: can_revoke_away,
|
||||||
|
can_set_away: can_set_away,
|
||||||
is_active: people.is_active_user_for_popover(user.user_id),
|
is_active: people.is_active_user_for_popover(user.user_id),
|
||||||
is_bot: user.is_bot,
|
is_bot: user.is_bot,
|
||||||
is_me: people.is_current_user(user.email),
|
is_me: is_me,
|
||||||
is_sender_popover: is_sender_popover,
|
is_sender_popover: is_sender_popover,
|
||||||
pm_with_uri: hash_util.pm_with_uri(user.email),
|
pm_with_uri: hash_util.pm_with_uri(user.email),
|
||||||
presence_status: presence.get_status(user.user_id),
|
presence_status: presence.get_status(user.user_id),
|
||||||
|
@ -761,6 +776,20 @@ exports.register_click_handlers = function () {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('body').on('click', '.set_away_status', function (e) {
|
||||||
|
popovers.hide_all();
|
||||||
|
user_status.server_set_away();
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('body').on('click', '.revoke_away_status', function (e) {
|
||||||
|
popovers.hide_all();
|
||||||
|
user_status.server_revoke_away();
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
$('#user_presences').on('click', 'span.arrow', function (e) {
|
$('#user_presences').on('click', 'span.arrow', function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
|
|
|
@ -78,4 +78,18 @@
|
||||||
<i class="fa fa-bullhorn" aria-hidden="true"></i> {{#tr this}}View messages sent{{/tr}}
|
<i class="fa fa-bullhorn" aria-hidden="true"></i> {{#tr this}}View messages sent{{/tr}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{{#if can_set_away}}
|
||||||
|
<li>
|
||||||
|
<a href="#" class="set_away_status">
|
||||||
|
<i class="fa fa-circle-thin" aria-hidden="true"></i> {{#tr this}}Set status to away{{/tr}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
{{#if can_revoke_away}}
|
||||||
|
<li>
|
||||||
|
<a href="#" class="revoke_away_status">
|
||||||
|
<i class="fa fa-circle-thin" aria-hidden="true"></i> {{#tr this}}Clear away status{{/tr}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue