fixes blockedChannel sync
This commit is contained in:
parent
7a26e77e27
commit
31c8ec5051
3 changed files with 14 additions and 14 deletions
12
dist/bundle.es.js
vendored
12
dist/bundle.es.js
vendored
|
@ -1517,9 +1517,9 @@ var _extends$2 = Object.assign || function (target) { for (var i = 1; i < argume
|
||||||
|
|
||||||
function extractUserState(rawObj) {
|
function extractUserState(rawObj) {
|
||||||
if (rawObj && rawObj.version === '0.1' && rawObj.value) {
|
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 {};
|
return {};
|
||||||
|
@ -1527,8 +1527,8 @@ function extractUserState(rawObj) {
|
||||||
|
|
||||||
function doPopulateSharedUserState(sharedSettings) {
|
function doPopulateSharedUserState(sharedSettings) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
const { subscriptions, tags, blockedChannels, settings } = extractUserState(sharedSettings);
|
const { subscriptions, tags, blocked, settings } = extractUserState(sharedSettings);
|
||||||
dispatch({ type: USER_STATE_POPULATE, data: { subscriptions, tags, blockedChannels, settings } });
|
dispatch({ type: USER_STATE_POPULATE, data: { subscriptions, tags, blocked, settings } });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5122,9 +5122,9 @@ const blockedReducer = handleActions({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[USER_STATE_POPULATE]: (state, action) => {
|
[USER_STATE_POPULATE]: (state, action) => {
|
||||||
const { blockedChannels } = action.data;
|
const { blocked } = action.data;
|
||||||
return _extends$e({}, state, {
|
return _extends$e({}, state, {
|
||||||
blockedChannels: blockedChannels && blockedChannels.length ? blockedChannels : state.blockedChannels
|
blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, defaultState$9);
|
}, defaultState$9);
|
||||||
|
|
|
@ -7,19 +7,19 @@ type SharedData = {
|
||||||
value: {
|
value: {
|
||||||
subscriptions?: Array<string>,
|
subscriptions?: Array<string>,
|
||||||
tags?: Array<string>,
|
tags?: Array<string>,
|
||||||
blockedChannels?: Array<string>,
|
blocked?: Array<string>,
|
||||||
settings?: any,
|
settings?: any,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function extractUserState(rawObj: SharedData) {
|
function extractUserState(rawObj: SharedData) {
|
||||||
if (rawObj && rawObj.version === '0.1' && rawObj.value) {
|
if (rawObj && rawObj.version === '0.1' && rawObj.value) {
|
||||||
const { subscriptions, tags, blockedChannels, settings} = rawObj.value;
|
const { subscriptions, tags, blocked, settings} = rawObj.value;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...(subscriptions ? { subscriptions } : {}),
|
...(subscriptions ? { subscriptions } : {}),
|
||||||
...(tags ? { tags } : {}),
|
...(tags ? { tags } : {}),
|
||||||
...(blockedChannels ? { blockedChannels } : {}),
|
...(blocked ? { blocked } : {}),
|
||||||
...(settings ? { settings } : {}),
|
...(settings ? { settings } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ function extractUserState(rawObj: SharedData) {
|
||||||
|
|
||||||
export function doPopulateSharedUserState(sharedSettings: any) {
|
export function doPopulateSharedUserState(sharedSettings: any) {
|
||||||
return (dispatch: Dispatch) => {
|
return (dispatch: Dispatch) => {
|
||||||
const { subscriptions, tags, blockedChannels, settings } = extractUserState(sharedSettings);
|
const { subscriptions, tags, blocked, settings } = extractUserState(sharedSettings);
|
||||||
dispatch({ type: ACTIONS.USER_STATE_POPULATE, data: { subscriptions, tags, blockedChannels, settings } });
|
dispatch({ type: ACTIONS.USER_STATE_POPULATE, data: { subscriptions, tags, blocked, settings } });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,13 @@ export const blockedReducer = handleActions(
|
||||||
},
|
},
|
||||||
[ACTIONS.USER_STATE_POPULATE]: (
|
[ACTIONS.USER_STATE_POPULATE]: (
|
||||||
state: BlocklistState,
|
state: BlocklistState,
|
||||||
action: { data: { blockedChannels: ?Array<string> } }
|
action: { data: { blocked: ?Array<string> } }
|
||||||
) => {
|
) => {
|
||||||
const { blockedChannels } = action.data;
|
const { blocked } = action.data;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
blockedChannels:
|
blockedChannels:
|
||||||
blockedChannels && blockedChannels.length ? blockedChannels : state.blockedChannels,
|
blocked && blocked.length ? blocked : state.blockedChannels,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue