mirror of https://github.com/zulip/zulip.git
composebox_typeahead: Optimize token identification.
This commit is contained in:
parent
e76c9f1200
commit
c348b907e7
|
@ -287,13 +287,13 @@ exports.compose_content_begins_typeahead = function (query) {
|
|||
return false;
|
||||
}
|
||||
|
||||
current_token = q.substring(q.lastIndexOf('@') + 1);
|
||||
current_token = current_token.substring(1);
|
||||
if (current_token.length < 1 || current_token.lastIndexOf('*') !== -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.completing = 'mention';
|
||||
this.token = current_token.substring(current_token.indexOf("@") + 1);
|
||||
this.token = current_token;
|
||||
var all_item = {
|
||||
special_item_text: "all (Notify everyone)",
|
||||
email: "all",
|
||||
|
@ -317,18 +317,19 @@ exports.compose_content_begins_typeahead = function (query) {
|
|||
return false;
|
||||
}
|
||||
|
||||
current_token = q.substring(q.lastIndexOf('#') + 1);
|
||||
if (current_token.length < 1) {
|
||||
if (current_token.length === 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
current_token = current_token.substring(1);
|
||||
|
||||
// Don't autocomplete if there is a space following a '#'
|
||||
if (current_token[0] === " ") {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.completing = 'stream';
|
||||
this.token = current_token.substring(current_token.indexOf("#")+1);
|
||||
this.token = current_token;
|
||||
return stream_data.subscribed_subs();
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue