mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -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');
|
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'
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue