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.

minor: Fix return value and redundant variables in pill_typeahead.

m-e-l-u-h-a-nedeb1bf53b2f
diff --git a/static/js/pill_typeahead.js b/static/js/pill_typeahead.js
index 45b80f5cac2..764dcc5f028 100644
--- a/static/js/pill_typeahead.js
+++ b/static/js/pill_typeahead.js
@@ -11,14 +11,14 @@ function person_matcher(query, item) {
if (people.is_known_user(item)) {
return composebox_typeahead.query_matches_person(query, item);
}
- return undefined;
+ return false;
}
function group_matcher(query, item) {
if (user_groups.is_user_group(item)) {
return composebox_typeahead.query_matches_name_description(query, item);
}
- return undefined;
+ return false;
}
export function set_up(input, pills, opts) {
@@ -30,11 +30,6 @@ export function set_up(input, pills, opts) {
const include_user_groups = opts.user_group;
const include_users = opts.user;
- let user_source;
- if (opts.user_source) {
- user_source = opts.user_source;
- }
-
input.typeahead({
items: 5,
fixed: true,
@@ -53,11 +48,11 @@ export function set_up(input, pills, opts) {
}
if (include_users) {
- if (user_source !== undefined) {
+ if (opts.user_source !== undefined) {
// If user_source is specified in opts, it
// is given priority. Otherwise we use
// default user_pill.typeahead_source.
- source = source.concat(user_source());
+ source = source.concat(opts.user_source());
} else {
source = source.concat(user_pill.typeahead_source(pills));
}