fixes blockedChannel sync #253

Merged
jessopb merged 1 commit from fix-blockedChannelSync into master 2019-12-16 19:23:54 +01:00
3 changed files with 14 additions and 14 deletions
Showing only changes of commit 31c8ec5051 - Show all commits

12
dist/bundle.es.js vendored
View file

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

View file

@ -7,19 +7,19 @@ type SharedData = {
value: {
subscriptions?: Array<string>,
tags?: Array<string>,
blockedChannels?: Array<string>,
blocked?: Array<string>,
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 } });
};
}

View file

@ -28,13 +28,13 @@ export const blockedReducer = handleActions(
},
[ACTIONS.USER_STATE_POPULATE]: (
state: BlocklistState,
action: { data: { blockedChannels: ?Array<string> } }
action: { data: { blocked: ?Array<string> } }
) => {
const { blockedChannels } = action.data;
const { blocked } = action.data;
return {
...state,
blockedChannels:
blockedChannels && blockedChannels.length ? blockedChannels : state.blockedChannels,
blocked && blocked.length ? blocked : state.blockedChannels,
};
},
},