Merge pull request #253 from lbryio/fix-blockedChannelSync

fixes blockedChannel sync
This commit is contained in:
Sean Yesmunt 2019-12-16 13:23:53 -05:00 committed by GitHub
commit ad3c4eb284
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

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,
};
},
},