mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
BUGFIX: error when find_similar_to has no response
This commit is contained in:
parent
a524194a46
commit
0bb02505b0
1 changed files with 5 additions and 1 deletions
|
@ -318,7 +318,11 @@ Discourse.Topic.reopenClass({
|
|||
**/
|
||||
findSimilarTo: function(title, body) {
|
||||
return Discourse.ajax("/topics/similar_to", { data: {title: title, raw: body} }).then(function (results) {
|
||||
return results.map(function(topic) { return Discourse.Topic.create(topic); });
|
||||
if (Array.isArray(results)) {
|
||||
return results.map(function(topic) { return Discourse.Topic.create(topic); });
|
||||
} else {
|
||||
return Ember.A();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue