mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	composebox_typeahead: Refactor content_highlighter to use switch/case.
This refactor should make no functional changes.
This commit is contained in:
		@@ -716,26 +716,30 @@ exports.get_candidates = function (query) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.content_highlighter = function (item) {
 | 
			
		||||
    if (this.completing === "emoji") {
 | 
			
		||||
    switch (this.completing) {
 | 
			
		||||
        case "emoji":
 | 
			
		||||
            return typeahead_helper.render_emoji(item);
 | 
			
		||||
    } else if (this.completing === "mention" || this.completing === "silent_mention") {
 | 
			
		||||
        case "mention":
 | 
			
		||||
            return typeahead_helper.render_person_or_user_group(item);
 | 
			
		||||
    } else if (this.completing === "slash") {
 | 
			
		||||
        case "silent_mention":
 | 
			
		||||
            return typeahead_helper.render_person_or_user_group(item);
 | 
			
		||||
        case "slash":
 | 
			
		||||
            return typeahead_helper.render_typeahead_item({
 | 
			
		||||
                primary: item.text,
 | 
			
		||||
            });
 | 
			
		||||
    } else if (this.completing === "stream") {
 | 
			
		||||
        case "stream":
 | 
			
		||||
            return typeahead_helper.render_stream(item);
 | 
			
		||||
    } else if (this.completing === "syntax") {
 | 
			
		||||
        case "syntax":
 | 
			
		||||
            return typeahead_helper.render_typeahead_item({primary: item});
 | 
			
		||||
    } else if (this.completing === "topic_jump") {
 | 
			
		||||
        case "topic_jump":
 | 
			
		||||
            return typeahead_helper.render_typeahead_item({primary: item});
 | 
			
		||||
    } else if (this.completing === "topic_list") {
 | 
			
		||||
        case "topic_list":
 | 
			
		||||
            return typeahead_helper.render_typeahead_item({primary: item});
 | 
			
		||||
    } else if (this.completing === "time_jump") {
 | 
			
		||||
        case "time_jump":
 | 
			
		||||
            return typeahead_helper.render_typeahead_item({primary: item});
 | 
			
		||||
    }
 | 
			
		||||
        default:
 | 
			
		||||
            return undefined;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const show_flatpickr = (element, callback, default_timestamp) => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user