diff options
author | Eugen <eugen@zeonfederated.com> | 2017-04-10 23:45:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-10 23:45:29 +0200 |
commit | 2810013b933bceb2a7c1d1b8b10d2714c39d1e15 (patch) | |
tree | 07b24c54c1137b65f813b3033448b17e6a580f9d /app/assets | |
parent | 0687ab8ae3c2573ba2aa1d37f62e3583d0c7ab01 (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.jsx | 12 |
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)); |