diff --git a/web/src/pill_typeahead.js b/web/src/pill_typeahead.js index d2de093fae..7131365b50 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.js index e7a7961c9a..69b998c3ab 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)) {