Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
pill_typeahead: Use query passed to source instead hacky this.
evykassirer9f83d14fb72a
diff --git a/web/src/pill_typeahead.js b/web/src/pill_typeahead.jsindex d2de093faeb..7131365b501 100644--- a/web/src/pill_typeahead.js+++ b/web/src/pill_typeahead.js@@ -40,9 +40,9 @@ export function set_up($input, pills, opts) {items: 5,fixed: true,dropup: true,- source() {+ source(query) {let source = [];- if (include_streams(this.query)) {+ if (include_streams(query)) {// If query starts with # we expect,// only stream suggestions so we simply// return stream source.diff --git a/web/tests/pill_typeahead.test.js b/web/tests/pill_typeahead.test.jsindex e7a7961c9a2..69b998c3ab1 100644--- a/web/tests/pill_typeahead.test.js+++ b/web/tests/pill_typeahead.test.js@@ -251,7 +251,7 @@ run_test("set_up", ({mock_template, override}) => {(function test_source() {let result;if (opts.stream) {- result = config.source.call(fake_stream_this);+ result = config.source(fake_stream_this.query);const stream_ids = result.map((stream) => stream.stream_id);const expected_stream_ids = [denmark.stream_id, sweden.stream_id];assert.deepEqual(stream_ids, expected_stream_ids);@@ -262,7 +262,7 @@ run_test("set_up", ({mock_template, override}) => {function is_group(item) {return item.members;}- result = config.source.call(fake_person_this);+ result = config.source(fake_person_this.query);actual_result = result.map((item) => {if (is_group(item)) {