U_S_P edited collection #422

Merged
jessopb merged 1 commit from persistEditedList into master 2021-08-02 15:45:43 +02:00
4 changed files with 25 additions and 3 deletions

14
dist/bundle.es.js vendored
View file

@ -1868,11 +1868,12 @@ function extractUserState(rawObj) {
app_welcome_version, app_welcome_version,
sharing_3P, sharing_3P,
unpublishedCollections, unpublishedCollections,
editedCollections,
builtinCollections, builtinCollections,
savedCollections savedCollections
} = rawObj.value; } = rawObj.value;
return _extends$1({}, subscriptions ? { subscriptions } : {}, following ? { following } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, coin_swap_codes ? { coin_swap_codes } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {}, unpublishedCollections ? { unpublishedCollections } : {}, builtinCollections ? { builtinCollections } : {}, savedCollections ? { savedCollections } : {}); return _extends$1({}, subscriptions ? { subscriptions } : {}, following ? { following } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, coin_swap_codes ? { coin_swap_codes } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {}, unpublishedCollections ? { unpublishedCollections } : {}, editedCollections ? { editedCollections } : {}, builtinCollections ? { builtinCollections } : {}, savedCollections ? { savedCollections } : {});
} }
return {}; return {};
@ -1890,6 +1891,7 @@ function doPopulateSharedUserState(sharedSettings) {
app_welcome_version, app_welcome_version,
sharing_3P, sharing_3P,
unpublishedCollections, unpublishedCollections,
editedCollections,
builtinCollections, builtinCollections,
savedCollections savedCollections
} = extractUserState(sharedSettings); } = extractUserState(sharedSettings);
@ -1905,6 +1907,7 @@ function doPopulateSharedUserState(sharedSettings) {
welcomeVersion: app_welcome_version, welcomeVersion: app_welcome_version,
allowAnalytics: sharing_3P, allowAnalytics: sharing_3P,
unpublishedCollections, unpublishedCollections,
editedCollections,
builtinCollections, builtinCollections,
savedCollections savedCollections
} }
@ -3702,6 +3705,7 @@ const makeSelectClaimUrlInCollection = url => reselect.createSelector(selectBuil
const itemsInCollections = []; const itemsInCollections = [];
collections.map(list => { collections.map(list => {
Object.entries(list).forEach(([key, value]) => { Object.entries(list).forEach(([key, value]) => {
// $FlowFixMe
value.items.map(item => { value.items.map(item => {
itemsInCollections.push(item); itemsInCollections.push(item);
}); });
@ -7776,8 +7780,14 @@ const collectionsReducer = handleActions({
})); }));
}, },
[USER_STATE_POPULATE]: (state, action) => { [USER_STATE_POPULATE]: (state, action) => {
const { builtinCollections, savedCollections, unpublishedCollections } = action.data; const {
builtinCollections,
savedCollections,
unpublishedCollections,
editedCollections
} = action.data;
return _extends$e({}, state, { return _extends$e({}, state, {
edited: editedCollections || state.edited,
unpublished: unpublishedCollections || state.unpublished, unpublished: unpublishedCollections || state.unpublished,
builtin: builtinCollections || state.builtin, builtin: builtinCollections || state.builtin,
saved: savedCollections || state.saved saved: savedCollections || state.saved

View file

@ -14,6 +14,7 @@ type SharedData = {
app_welcome_version?: number, app_welcome_version?: number,
sharing_3P?: boolean, sharing_3P?: boolean,
unpublishedCollections: CollectionGroup, unpublishedCollections: CollectionGroup,
editedCollections: CollectionGroup,
builtinCollections: CollectionGroup, builtinCollections: CollectionGroup,
savedCollections: Array<string>, savedCollections: Array<string>,
}, },
@ -31,6 +32,7 @@ function extractUserState(rawObj: SharedData) {
app_welcome_version, app_welcome_version,
sharing_3P, sharing_3P,
unpublishedCollections, unpublishedCollections,
editedCollections,
builtinCollections, builtinCollections,
savedCollections, savedCollections,
} = rawObj.value; } = rawObj.value;
@ -45,6 +47,7 @@ function extractUserState(rawObj: SharedData) {
...(app_welcome_version ? { app_welcome_version } : {}), ...(app_welcome_version ? { app_welcome_version } : {}),
...(sharing_3P ? { sharing_3P } : {}), ...(sharing_3P ? { sharing_3P } : {}),
...(unpublishedCollections ? { unpublishedCollections } : {}), ...(unpublishedCollections ? { unpublishedCollections } : {}),
...(editedCollections ? { editedCollections } : {}),
...(builtinCollections ? { builtinCollections } : {}), ...(builtinCollections ? { builtinCollections } : {}),
...(savedCollections ? { savedCollections } : {}), ...(savedCollections ? { savedCollections } : {}),
}; };
@ -65,6 +68,7 @@ export function doPopulateSharedUserState(sharedSettings: any) {
app_welcome_version, app_welcome_version,
sharing_3P, sharing_3P,
unpublishedCollections, unpublishedCollections,
editedCollections,
builtinCollections, builtinCollections,
savedCollections, savedCollections,
} = extractUserState(sharedSettings); } = extractUserState(sharedSettings);
@ -80,6 +84,7 @@ export function doPopulateSharedUserState(sharedSettings: any) {
welcomeVersion: app_welcome_version, welcomeVersion: app_welcome_version,
allowAnalytics: sharing_3P, allowAnalytics: sharing_3P,
unpublishedCollections, unpublishedCollections,
editedCollections,
builtinCollections, builtinCollections,
savedCollections, savedCollections,
}, },

View file

@ -158,9 +158,15 @@ const collectionsReducer = handleActions(
}); });
}, },
[ACTIONS.USER_STATE_POPULATE]: (state, action) => { [ACTIONS.USER_STATE_POPULATE]: (state, action) => {
const { builtinCollections, savedCollections, unpublishedCollections } = action.data; const {
builtinCollections,
savedCollections,
unpublishedCollections,
editedCollections,
} = action.data;
return { return {
...state, ...state,
edited: editedCollections || state.edited,
unpublished: unpublishedCollections || state.unpublished, unpublished: unpublishedCollections || state.unpublished,
builtin: builtinCollections || state.builtin, builtin: builtinCollections || state.builtin,
saved: savedCollections || state.saved, saved: savedCollections || state.saved,

View file

@ -175,6 +175,7 @@ export const makeSelectClaimUrlInCollection = (url: string) =>
const itemsInCollections = []; const itemsInCollections = [];
collections.map(list => { collections.map(list => {
Object.entries(list).forEach(([key, value]) => { Object.entries(list).forEach(([key, value]) => {
// $FlowFixMe
value.items.map(item => { value.items.map(item => {
itemsInCollections.push(item); itemsInCollections.push(item);
}); });