mirror of https://github.com/zulip/zulip.git
buddy list: Exclude current user from searches.
The current user gets excluded from all non-empty searches, even ones that match the user, since it can look funny when the user's at the top of a search, and you'd never need to search for yourself (again, since the current user is at the top of the buddy list).
This commit is contained in:
parent
712054e128
commit
2c719bdb3f
|
@ -78,7 +78,7 @@ activate_people();
|
||||||
run_test('simple search', () => {
|
run_test('simple search', () => {
|
||||||
const user_ids = buddy_data.get_filtered_and_sorted_user_ids('sel');
|
const user_ids = buddy_data.get_filtered_and_sorted_user_ids('sel');
|
||||||
|
|
||||||
assert.deepEqual(user_ids, [me.user_id, selma.user_id]);
|
assert.deepEqual(user_ids, [selma.user_id]);
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test('bulk_data_hacks', () => {
|
run_test('bulk_data_hacks', () => {
|
||||||
|
@ -98,9 +98,9 @@ run_test('bulk_data_hacks', () => {
|
||||||
assert.equal(user_ids.length, 0);
|
assert.equal(user_ids.length, 0);
|
||||||
|
|
||||||
// We match on "h" for the first name, and the result limit
|
// We match on "h" for the first name, and the result limit
|
||||||
// is relaxed for searches.
|
// is relaxed for searches. (We exclude "me", though.)
|
||||||
user_ids = buddy_data.get_filtered_and_sorted_user_ids('h');
|
user_ids = buddy_data.get_filtered_and_sorted_user_ids('h');
|
||||||
assert.equal(user_ids.length, 1000);
|
assert.equal(user_ids.length, 999);
|
||||||
|
|
||||||
// We match on "p" for the email.
|
// We match on "p" for the email.
|
||||||
user_ids = buddy_data.get_filtered_and_sorted_user_ids('p');
|
user_ids = buddy_data.get_filtered_and_sorted_user_ids('p');
|
||||||
|
|
|
@ -77,6 +77,8 @@ function filter_user_ids(filter_text, user_ids) {
|
||||||
return user_ids;
|
return user_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user_ids = _.reject(user_ids, people.is_my_user_id);
|
||||||
|
|
||||||
var search_terms = filter_text.toLowerCase().split(",");
|
var search_terms = filter_text.toLowerCase().split(",");
|
||||||
search_terms = _.map(search_terms, function (s) {
|
search_terms = _.map(search_terms, function (s) {
|
||||||
return s.trim();
|
return s.trim();
|
||||||
|
|
Loading…
Reference in New Issue