From ab8b50453b678499f63cecb8ede7b9cd7cb1e288 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 1 Feb 2019 01:33:01 +0000 Subject: [PATCH] user status: Show status in user info popovers. --- frontend_tests/node_tests/popovers.js | 7 +++++++ static/js/popovers.js | 1 + static/templates/user_info_popover_content.handlebars | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index fecfad9ead..18aa9491f6 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -6,6 +6,7 @@ zrequire('narrow'); zrequire('narrow_state'); zrequire('people'); zrequire('presence'); +zrequire('user_status'); var noop = function () {}; $.fn.popover = noop; // this will get wrapped by our code @@ -102,6 +103,11 @@ run_test('sender_hover', () => { sender_id: alice.user_id, }; + user_status.set_status_text({ + user_id: alice.user_id, + status_text: 'on the beach', + }); + var target = $.create('click target'); target.offset = () => { @@ -160,6 +166,7 @@ run_test('sender_hover', () => { is_active: true, is_bot: undefined, is_sender_popover: true, + status_text: 'on the beach', }); return 'content-html'; diff --git a/static/js/popovers.js b/static/js/popovers.js index e97e82727f..f44825e2c1 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -147,6 +147,7 @@ function render_user_info_popover(user, popover_element, is_sender_popover, priv user_last_seen_time_status: user_last_seen_time_status(user.user_id), user_time: people.get_user_time(user.user_id), user_type: people.get_user_type(user.user_id), + status_text: user_status.get_status_text(user.user_id), }; popover_element.popover({ diff --git a/static/templates/user_info_popover_content.handlebars b/static/templates/user_info_popover_content.handlebars index c3a677cc95..ef515b50db 100644 --- a/static/templates/user_info_popover_content.handlebars +++ b/static/templates/user_info_popover_content.handlebars @@ -24,6 +24,12 @@
  • {{#tr this}}(This user has been deactivated){{/tr}}
  • {{/if}} + {{#if status_text}} +
  • + {{status_text}} +
  • + {{/if}} + {{#if user_time}}
  • {{ user_time }} {{#tr this}}Local time{{/tr}}
  • {{/if}}