Commit 520243df authored by Eugen Rochko's avatar Eugen Rochko

Update src/reducer.js

parent 8abfd352
Pipeline #415 passed with stages
in 48 seconds
......@@ -30,6 +30,11 @@ const initialState = {
const DUNBAR = Math.log(300);
const blacklist = [
'cat.social', // Duplicate entry for quey.org
'switter.co', // Duplicate entry for sinblr.com
];
const sortByDunbarsNumber = instances => instances.sort((a, b) => {
const aa = Math.abs(DUNBAR - Math.log(a.active_users));
const bb = Math.abs(DUNBAR - Math.log(b.active_users));
......@@ -42,7 +47,7 @@ export default function reducer(state = initialState, action) {
case LOCALE_CHANGE:
return { ...state, locale: action.data };
case INSTANCES_FETCH_SUCCESS:
return { ...state, instances: sortByDunbarsNumber(action.data) };
return { ...state, instances: sortByDunbarsNumber(action.data.filter(instance => blacklist.indexOf(instance.name) === -1)) };
case FILTER_CATEGORY_CHANGE:
return { ...state, filter: { ...state.filter, category: action.data } };
case FILTER_LANGUAGE_CHANGE:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment