See #244 - Added notifications column settings to filter what's displayed

in the column and what appears as desktop notifications. Settings do not
persist yet
This commit is contained in:
Eugen Rochko 2017-01-02 14:09:57 +01:00
parent 75122e162d
commit 65647a2472
7 changed files with 221 additions and 8 deletions

View file

@ -1,7 +1,8 @@
import {
NOTIFICATIONS_UPDATE,
NOTIFICATIONS_REFRESH_SUCCESS,
NOTIFICATIONS_EXPAND_SUCCESS
NOTIFICATIONS_EXPAND_SUCCESS,
NOTIFICATIONS_SETTING_CHANGE
} from '../actions/notifications';
import { ACCOUNT_BLOCK_SUCCESS } from '../actions/accounts';
import Immutable from 'immutable';
@ -9,7 +10,23 @@ import Immutable from 'immutable';
const initialState = Immutable.Map({
items: Immutable.List(),
next: null,
loaded: false
loaded: false,
settings: Immutable.Map({
alerts: Immutable.Map({
follow: true,
favourite: true,
reblog: true,
mention: true
}),
shows: Immutable.Map({
follow: true,
favourite: true,
reblog: true,
mention: true
})
})
});
const notificationToMap = notification => Immutable.Map({
@ -58,6 +75,8 @@ export default function notifications(state = initialState, action) {
return appendNormalizedNotifications(state, action.notifications, action.next);
case ACCOUNT_BLOCK_SUCCESS:
return filterNotifications(state, action.relationship);
case NOTIFICATIONS_SETTING_CHANGE:
return state.setIn(['settings', ...action.key], action.checked);
default:
return state;
}