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
This commit is contained in:
Eugen
2017-04-10 23:45:29 +02:00
committed by GitHub
parent 0687ab8ae3
commit 2810013b93
6 changed files with 100 additions and 17 deletions

View File

@ -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));