Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

status_emoji: Show status emoji in compose_pm and mentions typeaheads.

YashRE4296682a351707
diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js
index 1b25b228eb9..8107477d2d4 100644
--- a/frontend_tests/node_tests/typeahead_helper.js
+++ b/frontend_tests/node_tests/typeahead_helper.js
@@ -697,6 +697,7 @@ test("render_emoji", ({mock_template}) => {
is_emoji: true,
has_image: false,
has_secondary: false,
+ has_status: false,
};
let rendered = false;
let test_emoji = {
@@ -725,6 +726,7 @@ test("render_emoji", ({mock_template}) => {
is_emoji: true,
has_image: true,
has_secondary: false,
+ has_status: false,
};
test_emoji = {
emoji_name: "realm_emoji",
diff --git a/static/js/typeahead_helper.js b/static/js/typeahead_helper.js
index 3c0869705bc..6d016311b43 100644
--- a/static/js/typeahead_helper.js
+++ b/static/js/typeahead_helper.js
@@ -12,6 +12,7 @@ import * as recent_senders from "./recent_senders";
import * as settings_data from "./settings_data";
import * as stream_data from "./stream_data";
import * as user_groups from "./user_groups";
+import * as user_status from "./user_status";
import * as util from "./util";
// Returns an array of private message recipients, removing empty elements.
@@ -68,6 +69,7 @@ export function make_query_highlighter(query) {
export function render_typeahead_item(args) {
args.has_image = args.img_src !== undefined;
+ args.has_status = args.status_emoji_info !== undefined;
args.has_secondary = args.secondary !== undefined;
return render_typeahead_list_item(args);
}
@@ -83,12 +85,16 @@ export function render_person(person) {
const avatar_url = people.small_avatar_url_for_person(person);
+ const status_emoji_info = user_status.get_status_emoji(person.user_id);
+
const typeahead_arguments = {
primary: person.full_name,
img_src: avatar_url,
user_circle_class,
is_person: true,
+ status_emoji_info,
};
+
typeahead_arguments.secondary = settings_data.email_for_user_settings(person);
return render_typeahead_item(typeahead_arguments);
}
diff --git a/static/templates/typeahead_list_item.hbs b/static/templates/typeahead_list_item.hbs
index fc7f55e39f8..e8ef8e8d051 100644
--- a/static/templates/typeahead_list_item.hbs
+++ b/static/templates/typeahead_list_item.hbs
@@ -24,6 +24,9 @@
<strong>
{{~ primary ~}}
</strong>
+{{~#if has_status}}
+{{> status_emoji status_emoji_info}}
+{{~/if}}
{{~#if has_secondary}}
&nbsp;&nbsp;
<small class="autocomplete_secondary">