Verified Commit cfefd0ae authored by Haelwenn's avatar Haelwenn
Browse files

Sync notification_settings

parent 4788384b
...@@ -117,7 +117,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) { ...@@ -117,7 +117,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) {
}; };
}; };
const excludeTypesFromSettings = state => state.getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS(); export const excludeTypesFromSettings = state => state.getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
const excludeTypesFromFilter = filter => { const excludeTypesFromFilter = filter => {
......
import api from 'flavours/glitch/util/api'; import api from 'flavours/glitch/util/api';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { showAlertForError } from './alerts'; import { showAlertForError } from './alerts';
import { excludeTypesFromSettings } from './notifications';
export const SETTING_CHANGE = 'SETTING_CHANGE'; export const SETTING_CHANGE = 'SETTING_CHANGE';
export const SETTING_SAVE = 'SETTING_SAVE'; export const SETTING_SAVE = 'SETTING_SAVE';
...@@ -24,6 +25,8 @@ const debouncedSave = debounce((dispatch, getState) => { ...@@ -24,6 +25,8 @@ const debouncedSave = debounce((dispatch, getState) => {
const data = getState().get('settings').filter((_, path) => path !== 'saved').toJS(); const data = getState().get('settings').filter((_, path) => path !== 'saved').toJS();
api(getState).put('/api/pleroma/notification_settings', { exclude_types: excludeTypesFromSettings(getState()) });
api(getState).put('/api/web/settings', { data }) api(getState).put('/api/web/settings', { data })
.then(() => dispatch({ type: SETTING_SAVE })) .then(() => dispatch({ type: SETTING_SAVE }))
.catch(error => dispatch(showAlertForError(error))); .catch(error => dispatch(showAlertForError(error)));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment