about summary refs log tree commit diff
path: root/app/assets
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-04-10 23:45:29 +0200
committerGitHub <noreply@github.com>2017-04-10 23:45:29 +0200
commit2810013b933bceb2a7c1d1b8b10d2714c39d1e15 (patch)
tree07b24c54c1137b65f813b3033448b17e6a580f9d /app/assets
parent0687ab8ae3c2573ba2aa1d37f62e3583d0c7ab01 (diff)
API param to exclude notification types from response (#1341)
* Add exclude_types param to /api/v1/notifications

* Exclude notification types in web UI through exclude_types in the API
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/components/actions/notifications.jsx12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/assets/javascripts/components/actions/notifications.jsx b/app/assets/javascripts/components/actions/notifications.jsx
index 980b7d63e..11e814e1f 100644
--- a/app/assets/javascripts/components/actions/notifications.jsx
+++ b/app/assets/javascripts/components/actions/notifications.jsx
@@ -61,6 +61,8 @@ export function refreshNotifications() {
       params.since_id = ids.first().get('id');
     }
 
+    params.exclude_types = getState().getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
+
     api(getState).get('/api/v1/notifications', { params }).then(response => {
       const next = getLinks(response).refs.find(link => link.rel === 'next');
 
@@ -105,11 +107,11 @@ export function expandNotifications() {
 
     dispatch(expandNotificationsRequest());
 
-    api(getState).get(url, {
-      params: {
-        limit: 5
-      }
-    }).then(response => {
+    const params = {};
+
+    params.exclude_types = getState().getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
+
+    api(getState).get(url, params).then(response => {
       const next = getLinks(response).refs.find(link => link.rel === 'next');
 
       dispatch(expandNotificationsSuccess(response.data, next ? next.uri : null));