mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
typeahead: Move highlight_with_escaping into render_person.
This commit is contained in:
@@ -342,8 +342,7 @@ exports.content_highlighter = function (item) {
|
|||||||
if (this.completing === 'emoji') {
|
if (this.completing === 'emoji') {
|
||||||
return "<img class='emoji' src='" + item.emoji_url + "' /> " + item.emoji_name;
|
return "<img class='emoji' src='" + item.emoji_url + "' /> " + item.emoji_name;
|
||||||
} else if (this.completing === 'mention') {
|
} else if (this.completing === 'mention') {
|
||||||
var item_formatted = typeahead_helper.render_person(item);
|
return typeahead_helper.render_person(this.token, item);
|
||||||
return typeahead_helper.highlight_with_escaping(this.token, item_formatted);
|
|
||||||
} else if (this.completing === 'stream') {
|
} else if (this.completing === 'stream') {
|
||||||
return typeahead_helper.render_stream(this.token, item);
|
return typeahead_helper.render_stream(this.token, item);
|
||||||
} else if (this.completing === 'syntax') {
|
} else if (this.completing === 'syntax') {
|
||||||
@@ -502,8 +501,7 @@ exports.initialize = function () {
|
|||||||
fixed: true,
|
fixed: true,
|
||||||
highlighter: function (item) {
|
highlighter: function (item) {
|
||||||
var query = get_last_recipient_in_pm(this.query);
|
var query = get_last_recipient_in_pm(this.query);
|
||||||
var item_formatted = typeahead_helper.render_person(item);
|
return typeahead_helper.render_person(query, item);
|
||||||
return typeahead_helper.highlight_with_escaping(query, item_formatted);
|
|
||||||
},
|
},
|
||||||
matcher: function (item) {
|
matcher: function (item) {
|
||||||
var current_recipient = get_last_recipient_in_pm(this.query);
|
var current_recipient = get_last_recipient_in_pm(this.query);
|
||||||
|
|||||||
@@ -183,8 +183,7 @@ function show_subscription_settings(sub_row) {
|
|||||||
source: people.get_realm_persons, // This is a function.
|
source: people.get_realm_persons, // This is a function.
|
||||||
items: 5,
|
items: 5,
|
||||||
highlighter: function (item) {
|
highlighter: function (item) {
|
||||||
var item_formatted = typeahead_helper.render_person(item);
|
return typeahead_helper.render_person(this.query, item);
|
||||||
return typeahead_helper.highlight_with_escaping(this.query, item_formatted);
|
|
||||||
},
|
},
|
||||||
matcher: function (item) {
|
matcher: function (item) {
|
||||||
var query = $.trim(this.query.toLowerCase());
|
var query = $.trim(this.query.toLowerCase());
|
||||||
|
|||||||
@@ -69,11 +69,15 @@ exports.highlight_query_in_phrase = function (query, phrase) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.render_person = function (person) {
|
exports.render_person = function (token, person) {
|
||||||
if (person.special_item_text) {
|
if (person.special_item_text) {
|
||||||
return person.special_item_text;
|
return person.special_item_text;
|
||||||
}
|
}
|
||||||
return person.full_name + " <" + person.email + ">";
|
|
||||||
|
var full_name = exports.highlight_with_escaping(token, person.full_name);
|
||||||
|
var email = exports.highlight_with_escaping(token, person.email);
|
||||||
|
|
||||||
|
return full_name + " <" + email + ">";
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.render_stream = function (token, stream) {
|
exports.render_stream = function (token, stream) {
|
||||||
|
|||||||
Reference in New Issue
Block a user