From cf4666d363f39c90aea74575b86de13618b6875a Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 7 Oct 2013 15:14:01 -0400 Subject: [PATCH] FIX: If the user asks for 0 similar topics, don't show an empty box --- .../discourse/controllers/composer_controller.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/composer_controller.js b/app/assets/javascripts/discourse/controllers/composer_controller.js index 2f1e9f156..c4ed025c0 100644 --- a/app/assets/javascripts/discourse/controllers/composer_controller.js +++ b/app/assets/javascripts/discourse/controllers/composer_controller.js @@ -181,8 +181,8 @@ Discourse.ComposerController = Discourse.Controller.extend({ title = this.get('model.title'); // Ensure the fields are of the minimum length - if (body.length < Discourse.SiteSettings.min_body_similar_length) return; - if (title.length < Discourse.SiteSettings.min_title_similar_length) return; + if (body.length < Discourse.SiteSettings.min_body_similar_length || + title.length < Discourse.SiteSettings.min_title_similar_length) { return; } var messageController = this.get('controllers.composerMessages'), similarTopics = this.get('similarTopics'); @@ -191,11 +191,13 @@ Discourse.ComposerController = Discourse.Controller.extend({ similarTopics.clear(); similarTopics.pushObjects(newTopics); - messageController.popup(Discourse.ComposerMessage.create({ - templateName: 'composer/similar_topics', - similarTopics: similarTopics, - extraClass: 'similar-topics' - })); + if (similarTopics.get('length') > 0) { + messageController.popup(Discourse.ComposerMessage.create({ + templateName: 'composer/similar_topics', + similarTopics: similarTopics, + extraClass: 'similar-topics' + })); + } }); },