From 52a5ad820749d8b561b794a8cf0b9229065f270a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 15 Oct 2016 16:54:50 +0200 Subject: [PATCH] Fix follow suggestions ranking --- .../features/compose/components/suggestions_box.jsx | 4 ++++ app/models/follow_suggestion.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/components/features/compose/components/suggestions_box.jsx b/app/assets/javascripts/components/features/compose/components/suggestions_box.jsx index baff317d76..3991fee4dc 100644 --- a/app/assets/javascripts/components/features/compose/components/suggestions_box.jsx +++ b/app/assets/javascripts/components/features/compose/components/suggestions_box.jsx @@ -52,6 +52,10 @@ const SuggestionsBox = React.createClass({ render () { const accounts = this.props.accounts.take(3); + if (account.size === 0) { + return
; + } + return (
Who to follow diff --git a/app/models/follow_suggestion.rb b/app/models/follow_suggestion.rb index 4f06db69cf..e925461345 100644 --- a/app/models/follow_suggestion.rb +++ b/app/models/follow_suggestion.rb @@ -7,7 +7,7 @@ START a=node:account_index(Account={id}) MATCH (a)-[:follows]->(b)-[:follows]->(c) WHERE a <> c AND NOT (a)-[:follows]->(c) -RETURN DISTINCT c.account_id +RETURN DISTINCT c.account_id, c.nodeRank ORDER BY c.nodeRank LIMIT {limit} END