From 31c8ec5051420febdbee85379581e99e09d0a1b6 Mon Sep 17 00:00:00 2001 From: jessop Date: Mon, 16 Dec 2019 13:20:07 -0500 Subject: [PATCH] fixes blockedChannel sync --- dist/bundle.es.js | 12 ++++++------ src/redux/actions/sync.js | 10 +++++----- src/redux/reducers/blocked.js | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 9d5fc8a..08cf676 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1517,9 +1517,9 @@ var _extends$2 = Object.assign || function (target) { for (var i = 1; i < argume function extractUserState(rawObj) { if (rawObj && rawObj.version === '0.1' && rawObj.value) { - const { subscriptions, tags, blockedChannels, settings } = rawObj.value; + const { subscriptions, tags, blocked, settings } = rawObj.value; - return _extends$2({}, subscriptions ? { subscriptions } : {}, tags ? { tags } : {}, blockedChannels ? { blockedChannels } : {}, settings ? { settings } : {}); + return _extends$2({}, subscriptions ? { subscriptions } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, settings ? { settings } : {}); } return {}; @@ -1527,8 +1527,8 @@ function extractUserState(rawObj) { function doPopulateSharedUserState(sharedSettings) { return dispatch => { - const { subscriptions, tags, blockedChannels, settings } = extractUserState(sharedSettings); - dispatch({ type: USER_STATE_POPULATE, data: { subscriptions, tags, blockedChannels, settings } }); + const { subscriptions, tags, blocked, settings } = extractUserState(sharedSettings); + dispatch({ type: USER_STATE_POPULATE, data: { subscriptions, tags, blocked, settings } }); }; } @@ -5122,9 +5122,9 @@ const blockedReducer = handleActions({ }; }, [USER_STATE_POPULATE]: (state, action) => { - const { blockedChannels } = action.data; + const { blocked } = action.data; return _extends$e({}, state, { - blockedChannels: blockedChannels && blockedChannels.length ? blockedChannels : state.blockedChannels + blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels }); } }, defaultState$9); diff --git a/src/redux/actions/sync.js b/src/redux/actions/sync.js index 3957a33..41a25ea 100644 --- a/src/redux/actions/sync.js +++ b/src/redux/actions/sync.js @@ -7,19 +7,19 @@ type SharedData = { value: { subscriptions?: Array, tags?: Array, - blockedChannels?: Array, + blocked?: Array, settings?: any, }, }; function extractUserState(rawObj: SharedData) { if (rawObj && rawObj.version === '0.1' && rawObj.value) { - const { subscriptions, tags, blockedChannels, settings} = rawObj.value; + const { subscriptions, tags, blocked, settings} = rawObj.value; return { ...(subscriptions ? { subscriptions } : {}), ...(tags ? { tags } : {}), - ...(blockedChannels ? { blockedChannels } : {}), + ...(blocked ? { blocked } : {}), ...(settings ? { settings } : {}), }; } @@ -29,8 +29,8 @@ function extractUserState(rawObj: SharedData) { export function doPopulateSharedUserState(sharedSettings: any) { return (dispatch: Dispatch) => { - const { subscriptions, tags, blockedChannels, settings } = extractUserState(sharedSettings); - dispatch({ type: ACTIONS.USER_STATE_POPULATE, data: { subscriptions, tags, blockedChannels, settings } }); + const { subscriptions, tags, blocked, settings } = extractUserState(sharedSettings); + dispatch({ type: ACTIONS.USER_STATE_POPULATE, data: { subscriptions, tags, blocked, settings } }); }; } diff --git a/src/redux/reducers/blocked.js b/src/redux/reducers/blocked.js index 7a9fd85..b69d9c9 100644 --- a/src/redux/reducers/blocked.js +++ b/src/redux/reducers/blocked.js @@ -28,13 +28,13 @@ export const blockedReducer = handleActions( }, [ACTIONS.USER_STATE_POPULATE]: ( state: BlocklistState, - action: { data: { blockedChannels: ?Array } } + action: { data: { blocked: ?Array } } ) => { - const { blockedChannels } = action.data; + const { blocked } = action.data; return { ...state, blockedChannels: - blockedChannels && blockedChannels.length ? blockedChannels : state.blockedChannels, + blocked && blocked.length ? blocked : state.blockedChannels, }; }, },