Skip to content
Snippets Groups Projects
Commit 22b91872 authored by dbh's avatar dbh Committed by Yannick Tivisse
Browse files

[IMP] mail: add delay of 500ms to display the canned responses

parent 5d0b9285
Branches
Tags
No related merge requests found
......@@ -490,6 +490,7 @@ var BasicComposer = Widget.extend({
return;
}
clearTimeout(this.canned_timeout);
var self = this;
this.preprocess_message().then(function (message) {
self.trigger('post_message', message);
......@@ -713,12 +714,18 @@ var BasicComposer = Widget.extend({
});
},
mention_get_canned_responses: function (search) {
var canned_responses = chat_manager.get_canned_responses();
var matches = fuzzy.filter(utils.unaccent(search), _.pluck(canned_responses, 'source'));
var indexes = _.pluck(matches.slice(0, this.options.mention_fetch_limit), 'index');
return _.map(indexes, function (i) {
return canned_responses[i];
});
var self = this;
var def = $.Deferred();
clearTimeout(this.canned_timeout);
this.canned_timeout = setTimeout(function() {
var canned_responses = chat_manager.get_canned_responses();
var matches = fuzzy.filter(utils.unaccent(search), _.pluck(canned_responses, 'source'));
var indexes = _.pluck(matches.slice(0, self.options.mention_fetch_limit), 'index');
def.resolve(_.map(indexes, function (i) {
return canned_responses[i];
}));
}, 500);
return def;
},
mention_get_commands: function (search) {
var search_regexp = new RegExp(_.str.escapeRegExp(utils.unaccent(search)), 'i');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment