FIX: If the user asks for 0 similar topics, don't show an empty box

This commit is contained in:
Robin Ward 2013-10-07 15:14:01 -04:00
parent 744266374a
commit cf4666d363

View file

@ -181,8 +181,8 @@ Discourse.ComposerController = Discourse.Controller.extend({
title = this.get('model.title'); title = this.get('model.title');
// Ensure the fields are of the minimum length // Ensure the fields are of the minimum length
if (body.length < Discourse.SiteSettings.min_body_similar_length) return; if (body.length < Discourse.SiteSettings.min_body_similar_length ||
if (title.length < Discourse.SiteSettings.min_title_similar_length) return; title.length < Discourse.SiteSettings.min_title_similar_length) { return; }
var messageController = this.get('controllers.composerMessages'), var messageController = this.get('controllers.composerMessages'),
similarTopics = this.get('similarTopics'); similarTopics = this.get('similarTopics');
@ -191,11 +191,13 @@ Discourse.ComposerController = Discourse.Controller.extend({
similarTopics.clear(); similarTopics.clear();
similarTopics.pushObjects(newTopics); similarTopics.pushObjects(newTopics);
if (similarTopics.get('length') > 0) {
messageController.popup(Discourse.ComposerMessage.create({ messageController.popup(Discourse.ComposerMessage.create({
templateName: 'composer/similar_topics', templateName: 'composer/similar_topics',
similarTopics: similarTopics, similarTopics: similarTopics,
extraClass: 'similar-topics' extraClass: 'similar-topics'
})); }));
}
}); });
}, },