Verified Commit 08315d64 authored by Haelwenn's avatar Haelwenn
Browse files

initial_state: sync notifications.shows with pleroma notification_settings

parent cfefd0ae
Pipeline #27859 passed with stage
in 4 minutes and 56 seconds
......@@ -25,7 +25,10 @@ const debouncedSave = debounce((dispatch, getState) => {
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/pleroma/notification_settings',
{ exclude_types: excludeTypesFromSettings(getState()) }
).catch(error => dispatch(showAlertForError(error)));
api(getState).put('/api/web/settings', { data })
.then(() => dispatch({ type: SETTING_SAVE }))
......
......@@ -6,6 +6,17 @@ const initialState = element && function () {
} catch (e) {
result.local_settings = {};
}
const res_me = result.meta && result.meta['me'];
const res_my_acct = res_me && result.accounts && result.accounts[res_me];
const exclude_types = res_my_acct && res_my_acct['pleroma']['notification_settings']['exclude_types'];
if (exclude_types && result['settings']['notifications']['shows']) {
var show_types = result['settings']['notifications']['shows'];
exclude_types.forEach(x => show_types[x] = false);
result['settings']['notifications']['shows'] = show_types;
}
return result;
}();
......
Markdown is supported
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