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
1 changed files with 10 additions and 2 deletions

View File

@ -425,9 +425,17 @@ export default Ember.Component.extend({
let name = $e.data('name'); let name = $e.data('name');
if (found.indexOf(name) === -1) { if (found.indexOf(name) === -1) {
// 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 }]); this.sendAction('cannotSeeMention', [{ name: name }]);
found.push(name); found.push(name);
} }
}, 2000);
}
}); });
this.set('warnedCannotSeeMentions', found); this.set('warnedCannotSeeMentions', found);