Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Commit

Permalink
Remove Neo4J
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Nov 24, 2016
1 parent fca1839 commit 8efa081
Show file tree
Hide file tree
Showing 23 changed files with 6 additions and 323 deletions.
File renamed without changes.
17 changes: 0 additions & 17 deletions Dockerfile.neo4j

This file was deleted.

1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ gem 'rack-attack'
gem 'rack-cors', require: 'rack/cors'
gem 'sidekiq'
gem 'ledermann-rails-settings'
gem 'neography'
gem 'pg_search'

gem 'react-rails'
Expand Down
11 changes: 0 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ GEM
thread
thread_safe
erubis (2.7.0)
excon (0.53.0)
execjs (2.7.0)
fabrication (2.15.2)
fast_blank (1.0.0)
Expand Down Expand Up @@ -213,19 +212,11 @@ GEM
mini_portile2 (2.1.0)
minitest (5.9.1)
multi_json (1.12.1)
neography (1.8.0)
excon (>= 0.33.0)
json (>= 1.7.7)
multi_json (>= 1.3.2)
os (>= 0.9.6)
rake (>= 0.8.7)
rubyzip (>= 1.0.0)
nio4r (1.2.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
oj (2.17.3)
orm_adapter (0.5.0)
os (0.9.6)
ostatus2 (1.0.2)
addressable (~> 2.4)
http (~> 2.0)
Expand Down Expand Up @@ -339,7 +330,6 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rubyzip (1.2.0)
safe_yaml (1.0.4)
sass (3.4.22)
sass-rails (5.0.6)
Expand Down Expand Up @@ -435,7 +425,6 @@ DEPENDENCIES
letter_opener
link_header
lograge
neography
nokogiri
oj
ostatus2
Expand Down
37 changes: 0 additions & 37 deletions app/assets/javascripts/components/actions/suggestions.jsx

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 4 additions & 11 deletions app/assets/javascripts/components/features/compose/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import ComposeFormContainer from './containers/compose_form_container';
import UploadFormContainer from './containers/upload_form_container';
import NavigationContainer from './containers/navigation_container';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import SuggestionsContainer from './containers/suggestions_container';
import SearchContainer from './containers/search_container';
import { fetchSuggestions } from '../../actions/suggestions';
import { connect } from 'react-redux';
import { mountCompose, unmountCompose } from '../../actions/compose';

Expand All @@ -19,7 +17,6 @@ const Compose = React.createClass({

componentDidMount () {
this.props.dispatch(mountCompose());
this.props.dispatch(fetchSuggestions());
},

componentWillUnmount () {
Expand All @@ -29,14 +26,10 @@ const Compose = React.createClass({
render () {
return (
<Drawer>
<div style={{ flex: '1 1 auto' }}>
<SearchContainer />
<NavigationContainer />
<ComposeFormContainer />
<UploadFormContainer />
</div>

<SuggestionsContainer />
<SearchContainer />
<NavigationContainer />
<ComposeFormContainer />
<UploadFormContainer />
</Drawer>
);
}
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/components/locales/de.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const en = {
"search.placeholder": "Suche",
"search.account": "Konto",
"search.hashtag": "Hashtag",
"suggestions_box.who_to_follow": "Wem folgen",
"suggestions_box.refresh": "Aktualisieren",
"upload_button.label": "Media-Datei anfügen",
"upload_form.undo": "Entfernen",
"notification.follow": "{name} folgt dir",
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/components/locales/en.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ const en = {
"search.placeholder": "Search",
"search.account": "Account",
"search.hashtag": "Hashtag",
"suggestions_box.who_to_follow": "Who to follow",
"suggestions_box.refresh": "Refresh",
"upload_button.label": "Add media",
"upload_form.undo": "Undo",
"notification.follow": "{name} followed you",
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/components/locales/es.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ const es = {
"search.placeholder": "Buscar",
"search.account": "Cuenta",
"search.hashtag": "Etiqueta",
"suggestions_box.who_to_follow": "A quién seguir",
"suggestions_box.refresh": "Refrescar",
"upload_button.label": "Añadir medio",
"upload_form.undo": "Deshacer",
"notification.follow": "{name} le esta ahora siguiendo",
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/components/locales/fr.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const fr = {
"search.placeholder": "Chercher",
"search.account": "Compte",
"search.hashtag": "Mot-clé",
"suggestions_box.who_to_follow": "Suggestions",
"suggestions_box.refresh": "Rafraîchir",
"upload_button.label": "Joindre un média",
"upload_form.undo": "Annuler",
"notification.follow": "{name} s’est abonné⋅e à vos statuts",
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/components/locales/pt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ const pt = {
"search.placeholder": "Busca",
"search.account": "Conta",
"search.hashtag": "Hashtag",
"suggestions_box.who_to_follow": "Quem seguir",
"suggestions_box.refresh": "Recarregar",
"upload_button.label": "Adicionar media",
"upload_form.undo": "Desfazer"
};
Expand Down
4 changes: 0 additions & 4 deletions app/assets/javascripts/components/reducers/user_lists.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
FOLLOWING_FETCH_SUCCESS,
FOLLOWING_EXPAND_SUCCESS
} from '../actions/accounts';
import { SUGGESTIONS_FETCH_SUCCESS } from '../actions/suggestions';
import {
REBLOGS_FETCH_SUCCESS,
FAVOURITES_FETCH_SUCCESS
Expand All @@ -14,7 +13,6 @@ import Immutable from 'immutable';
const initialState = Immutable.Map({
followers: Immutable.Map(),
following: Immutable.Map(),
suggestions: Immutable.List(),
reblogged_by: Immutable.Map(),
favourited_by: Immutable.Map()
});
Expand Down Expand Up @@ -42,8 +40,6 @@ export default function userLists(state = initialState, action) {
return normalizeList(state, 'following', action.id, action.accounts, action.next);
case FOLLOWING_EXPAND_SUCCESS:
return appendToList(state, 'following', action.id, action.accounts, action.next);
case SUGGESTIONS_FETCH_SUCCESS:
return state.set('suggestions', Immutable.List(action.accounts.map(item => item.id)));
case REBLOGS_FETCH_SUCCESS:
return state.setIn(['reblogged_by', action.id], Immutable.List(action.accounts.map(item => item.id)));
case FAVOURITES_FETCH_SUCCESS:
Expand Down
10 changes: 0 additions & 10 deletions app/controllers/api/v1/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ def followers
render action: :index
end

def common_followers
@accounts = @account.common_followers_with(current_user.account)
render action: :index
end

def suggestions
@accounts = FollowSuggestion.get(current_user.account_id)
render action: :index
end

def statuses
@statuses = @account.statuses.paginate_by_max_id(DEFAULT_STATUSES_LIMIT, params[:max_id], params[:since_id]).to_a
@statuses = cache(@statuses)
Expand Down
9 changes: 0 additions & 9 deletions app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ def to_param
username
end

def common_followers_with(other_account)
results = Neography::Rest.new.execute_query('MATCH (a {account_id: {a_id}})-[:follows]->(b)-[:follows]->(c {account_id: {c_id}}) RETURN b.account_id', a_id: id, c_id: other_account.id)
ids = results['data'].map(&:first)
accounts = Account.where(id: ids).with_counters.limit(20).map { |a| [a.id, a] }.to_h
ids.map { |id| accounts[id] }.compact
rescue Neography::NeographyError, Excon::Error::Socket
[]
end

class << self
def find_local!(username)
find_remote!(username, nil)
Expand Down
28 changes: 0 additions & 28 deletions app/models/follow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,4 @@ def object_type
def title
destroyed? ? "#{account.acct} is no longer following #{target_account.acct}" : "#{account.acct} started following #{target_account.acct}"
end

after_create :add_to_graph
after_destroy :remove_from_graph

def sync!
add_to_graph
end

private

def add_to_graph
neo = Neography::Rest.new

a = neo.create_unique_node('account_index', 'Account', account_id.to_s, account_id: account_id)
b = neo.create_unique_node('account_index', 'Account', target_account_id.to_s, account_id: target_account_id)

neo.create_unique_relationship('follow_index', 'Follow', id.to_s, 'follows', a, b)
rescue Neography::NeographyError, Excon::Error::Socket => e
Rails.logger.error e
end

def remove_from_graph
neo = Neography::Rest.new
rel = neo.get_relationship_index('follow_index', 'Follow', id.to_s)
neo.delete_relationship(rel)
rescue Neography::NeographyError, Excon::Error::Socket => e
Rails.logger.error e
end
end
Loading

0 comments on commit 8efa081

Please sign in to comment.