Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
J
joinmastodon
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
20
Issues
20
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mastodon
joinmastodon
Commits
520243df
Commit
520243df
authored
Dec 18, 2018
by
Eugen Rochko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update src/reducer.js
parent
8abfd352
Pipeline
#415
passed with stages
in 48 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
reducer.js
src/reducer.js
+6
-1
No files found.
src/reducer.js
View file @
520243df
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment