FEATURE: add a delay on the "mention" warning in composer

Previously we would warn too early about lack of visibility
This commit is contained in:
Sam 2018-05-01 15:40:44 +10:00
parent d942bf6282
commit 5a6c5f2083

View File

@ -425,8 +425,16 @@ export default Ember.Component.extend({
let name = $e.data('name');
if (found.indexOf(name) === -1) {
this.sendAction('cannotSeeMention', [{ name: name }]);
found.push(name);
// add a delay to allow for typing, so you don't open the warning right away
// previously we would warn after @bob even if you were about to mention @bob2
Em.run.later(this, () => {
if ($preview.find('.mention.cannot-see[data-name="' + name + '"]').length > 0) {
this.sendAction('cannotSeeMention', [{ name: name }]);
found.push(name);
}
}, 2000);
}
});