about summary refs log tree commit diff
path: root/app/javascript/mastodon/reducers/trends.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-05-27 21:45:30 +0200
committerGitHub <noreply@github.com>2018-05-27 21:45:30 +0200
commit9bd23dc4e51ba47283a8e3a66cd94b4e624a5235 (patch)
tree119802887a7b894ea3aac5e28a8a7a15524c1c35 /app/javascript/mastodon/reducers/trends.js
parent63c7b9157274f57c496399a1a5c728b32415034c (diff)
Track trending tags (#7638)
* Track trending tags

- Half-life of 1 day
- Historical usage in daily buckets (last 7 days stored)
- GET /api/v1/trends

Fix #271

* Add trends to web UI

* Don't render compose form on search route, adjust search results header

* Disqualify tag from trends if it's in disallowed hashtags setting

* Count distinct accounts using tag, ignore silenced accounts
Diffstat (limited to 'app/javascript/mastodon/reducers/trends.js')
-rw-r--r--app/javascript/mastodon/reducers/trends.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/javascript/mastodon/reducers/trends.js b/app/javascript/mastodon/reducers/trends.js
new file mode 100644
index 000000000..95cf8f284
--- /dev/null
+++ b/app/javascript/mastodon/reducers/trends.js
@@ -0,0 +1,13 @@
+import { TRENDS_FETCH_SUCCESS } from '../actions/trends';
+import { fromJS } from 'immutable';
+
+const initialState = null;
+
+export default function trendsReducer(state = initialState, action) {
+  switch(action.type) {
+  case TRENDS_FETCH_SUCCESS:
+    return fromJS(action.trends);
+  default:
+    return state;
+  }
+};