Skip to content

A platform for community discussion. Free, open, simple.

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

Sam5a6c5f20834d
diff --git a/app/assets/javascripts/discourse/components/composer-editor.js.es6 b/app/assets/javascripts/discourse/components/composer-editor.js.es6
index 43d33da68fa..86b4d39f87d 100644
--- a/app/assets/javascripts/discourse/components/composer-editor.js.es6
+++ b/app/assets/javascripts/discourse/components/composer-editor.js.es6
@@ -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);
+
}
});