Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_info_popover: Show status emoji.
Riken Shahcea961b1290e
diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.jsindex 4a1738b8acf..d7a8fa5b188 100644--- a/frontend_tests/node_tests/popovers.js+++ b/frontend_tests/node_tests/popovers.js@@ -39,6 +39,7 @@ mock_esm("../../static/js/stream_popover", {const people = zrequire("people");const user_status = zrequire("user_status");const message_edit = zrequire("message_edit");+const emoji = zrequire("../shared/js/emoji");// Bypass some scary code that runs when we import the module.const popovers = with_field($.fn, "popover", noop, () => zrequire("popovers"));@@ -111,6 +112,7 @@ function test_ui(label, f) {test_ui("sender_hover", ({override, mock_template}) => {override($.fn, "popover", noop);+ override(emoji, "get_emoji_details_by_name", noop);const selection = ".sender_name, .sender_name-in-status, .inline_profile_picture";const handler = $("#main_div").get_on_handler("click", selection);@@ -125,6 +127,14 @@ test_ui("sender_hover", ({override, mock_template}) => {status_text: "on the beach",});+ const status_emoji_info = {+ emoji_name: "car",+ emoji_code: "1f697",+ reaction_type: "unicode_emoji",+ emoji_alt_code: false,+ };+ user_status.set_status_emoji({user_id: alice.user_id, ...status_emoji_info});+rows.id = () => message.id;message_lists.current.get = (msg_id) => {@@ -182,7 +192,9 @@ test_ui("sender_hover", ({override, mock_template}) => {is_bot: undefined,is_sender_popover: true,has_message_context: true,+ status_content_available: true,status_text: "on the beach",+ status_emoji_info,user_mention_syntax: "@**Alice Smith**",});return "content-html";diff --git a/static/js/popovers.js b/static/js/popovers.jsindex 904fd6da232..fc90e256125 100644--- a/static/js/popovers.js+++ b/static/js/popovers.js@@ -205,6 +205,8 @@ function render_user_info_popover(const muting_allowed = !is_me && !user.is_bot;const is_muted = muted_users.is_user_muted(user.user_id);+ const status_text = user_status.get_status_text(user.user_id);+ const status_emoji_info = user_status.get_status_emoji(user.user_id);const args = {can_revoke_away,@@ -228,7 +230,9 @@ function render_user_info_popover(user_last_seen_time_status: buddy_data.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),+ status_content_available: Boolean(status_text || status_emoji_info),+ status_text,+ status_emoji_info,user_mention_syntax: people.get_mention_syntax(user.full_name, user.user_id),};@@ -932,6 +936,8 @@ export function register_click_handlers() {user_status.server_update({user_id: me,status_text: "",+ emoji_name: "",+ emoji_code: "",success() {$(".info_popover_actions #status_message").html("");},diff --git a/static/styles/popovers.css b/static/styles/popovers.cssindex 73f9a8659c1..afebd27e9d3 100644--- a/static/styles/popovers.css+++ b/static/styles/popovers.css@@ -645,6 +645,11 @@ ul {.user_info_status_text {opacity: 0.8;padding: 2px 0 3px 0;+ .status_emoji {+ height: 18px;+ width: 18px;+ top: 2px;+ }}#move_topic_modal {diff --git a/static/templates/user_info_popover_content.hbs b/static/templates/user_info_popover_content.hbsindex 34f58d1aeef..be4837b18c5 100644--- a/static/templates/user_info_popover_content.hbs+++ b/static/templates/user_info_popover_content.hbs@@ -79,11 +79,20 @@</li>{{/if}}- {{#if status_text}}+ {{#if status_content_available}}{{#unless is_me}}<hr />{{/unless}}<li class="user_info_status_text"><span id="status_message">{{status_text}}+ {{#if status_emoji_info.emoji_alt_code}}+ <div class="emoji_alt_code"> :{{status_emoji_info.emoji_name}}:</div>+ {{else}}+ {{#if status_emoji_info.url}}+ <img src="{{status_emoji_info.url}}" class="emoji status_emoji" />+ {{else}}+ <div class="emoji status_emoji emoji-{{status_emoji_info.emoji_code}}"></div>+ {{/if}}+ {{/if}}{{#if is_me}}(<a tabindex="0" class="clear_status">{{#tr}}clear{{/tr}}</a>){{/if}}</span></li>