mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Autocomplete names w/spaces in search.
See trac #1356. (imported from commit 6aaf122c0f6d7b1d92bb074e8f3fbb93d0b63ceb)
This commit is contained in:
		
				
					committed by
					
						
						Steve Howell
					
				
			
			
				
	
			
			
			
						parent
						
							0b9497305f
						
					
				
				
					commit
					0b4c37ef8d
				
			@@ -7,9 +7,14 @@ function phrase_match(phrase, q) {
 | 
			
		||||
    var i;
 | 
			
		||||
    q = q.toLowerCase();
 | 
			
		||||
 | 
			
		||||
    phrase = phrase.toLowerCase();
 | 
			
		||||
    if (phrase.indexOf(q) === 0) {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var parts = phrase.split(' ');
 | 
			
		||||
    for (i = 0; i < parts.length; i++) {
 | 
			
		||||
        if (parts[i].toLowerCase().indexOf(q) === 0) {
 | 
			
		||||
        if (parts[i].indexOf(q) === 0) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -202,4 +202,13 @@ var search = set_up_dependencies();
 | 
			
		||||
    assert.equal(describe('sender:ted@zulip.com'),
 | 
			
		||||
        "Narrow to messages sent by <strong>Te</strong>d Smith <<strong>te</strong>d@zulip.com>");
 | 
			
		||||
 | 
			
		||||
    suggestions = search.get_suggestions('Ted '); // note space
 | 
			
		||||
 | 
			
		||||
    expected = [
 | 
			
		||||
        "Ted",
 | 
			
		||||
        "pm-with:ted@zulip.com",
 | 
			
		||||
        "sender:ted@zulip.com"
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    assert.deepEqual(suggestions.strings, expected);
 | 
			
		||||
}());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user