mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
refactor: Use people.my_current_email() in search_suggestion.js.
This commit is contained in:
@@ -21,9 +21,19 @@ var people = global.people;
|
|||||||
|
|
||||||
var search = require('js/search_suggestion.js');
|
var search = require('js/search_suggestion.js');
|
||||||
|
|
||||||
set_global('page_params', {
|
var bob = {
|
||||||
email: 'bob@zulip.com',
|
email: 'bob@zulip.com',
|
||||||
});
|
full_name: 'Bob Roberts',
|
||||||
|
user_id: 42,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
people.init();
|
||||||
|
people.add(bob);
|
||||||
|
people.initialize_current_user(bob.email);
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
|
||||||
set_global('narrow', {});
|
set_global('narrow', {});
|
||||||
|
|
||||||
@@ -101,6 +111,7 @@ global.stream_data.populate_stream_topics_for_tests({});
|
|||||||
var expected = [
|
var expected = [
|
||||||
"is:private",
|
"is:private",
|
||||||
"pm-with:alice@zulip.com",
|
"pm-with:alice@zulip.com",
|
||||||
|
"pm-with:bob@zulip.com",
|
||||||
"pm-with:ted@zulip.com",
|
"pm-with:ted@zulip.com",
|
||||||
];
|
];
|
||||||
assert.deepEqual(suggestions.strings, expected);
|
assert.deepEqual(suggestions.strings, expected);
|
||||||
@@ -204,7 +215,7 @@ global.stream_data.populate_stream_topics_for_tests({});
|
|||||||
assert.deepEqual(suggestions.strings, expected);
|
assert.deepEqual(suggestions.strings, expected);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
people.init();
|
init();
|
||||||
|
|
||||||
(function test_empty_query_suggestions() {
|
(function test_empty_query_suggestions() {
|
||||||
var query = '';
|
var query = '';
|
||||||
|
|||||||
@@ -369,8 +369,8 @@ function get_sent_by_me_suggestions(query, operators) {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var sender_query = 'sender:' + page_params.email;
|
var sender_query = 'sender:' + people.my_current_email();
|
||||||
var from_query = 'from:' + page_params.email;
|
var from_query = 'from:' + people.my_current_email();
|
||||||
var description = 'Sent by me';
|
var description = 'Sent by me';
|
||||||
|
|
||||||
query = query.toLowerCase();
|
query = query.toLowerCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user