From 2810013b933bceb2a7c1d1b8b10d2714c39d1e15 Mon Sep 17 00:00:00 2001 From: Eugen Date: Mon, 10 Apr 2017 23:45:29 +0200 Subject: 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 --- app/assets/javascripts/components/actions/notifications.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'app/assets/javascripts') 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)); -- cgit