mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: If the user asks for 0 similar topics, don't show an empty box
This commit is contained in:
parent
744266374a
commit
cf4666d363
1 changed files with 9 additions and 7 deletions
|
@ -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'
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue