diff --git a/src/api/communicators.json b/src/api/communicators.json index c76acc5ed..840795576 100644 --- a/src/api/communicators.json +++ b/src/api/communicators.json @@ -7,6 +7,10 @@ "email": "support@cboard.io", "rootBoard": "root", "boards": ["root"], - "defaultBoardBlackList": [] + "defaultBoardBlackList": [], + "defaultBoardsIncluded": [ + { "nameOnJSON": "advanced", "homeBoard": "root" }, + { "nameOnJSON": "picSeePal", "homeBoard": "jjmlUcQs19" } + ] } ] diff --git a/src/api/corePicSeePal.json b/src/api/corePicSeePal.json index f6c6f9749..52edbd5f3 100644 --- a/src/api/corePicSeePal.json +++ b/src/api/corePicSeePal.json @@ -803,7 +803,7 @@ "sound": "", "type": "folder", "backgroundColor": "#2196F3", - "linkedBoard": false, + "linkedBoard": true, "id": "auYUsFh3-qI" } ], diff --git a/src/components/App/App.constants.js b/src/components/App/App.constants.js index 5f61126da..5e10a0fa1 100644 --- a/src/components/App/App.constants.js +++ b/src/components/App/App.constants.js @@ -63,3 +63,23 @@ export const APP_LANGS = [ 'zh-CN', 'zu-ZA' // for crowdin contextual translation ]; + +export const USER_DATA_PROPERTIES = [ + 'id', + 'google', + 'facebook', + 'apple', + 'name', + 'role', + 'provider', + 'locale', + 'password', + 'location', + 'email', + 'isFirstLogin', + 'birthdate', + 'lastlogin', + 'createdAt', + 'updatedAt', + 'authToken' +]; diff --git a/src/components/App/App.reducer.js b/src/components/App/App.reducer.js index 694f4babc..9718c012b 100644 --- a/src/components/App/App.reducer.js +++ b/src/components/App/App.reducer.js @@ -7,7 +7,8 @@ import { UPDATE_USER_DATA, DISABLE_TOUR, ENABLE_ALL_TOURS, - SET_UNLOGGED_USER_LOCATION + SET_UNLOGGED_USER_LOCATION, + USER_DATA_PROPERTIES } from './App.constants'; import { LOGIN_SUCCESS, LOGOUT } from '../Account/Login/Login.constants'; import { @@ -60,6 +61,15 @@ const initialState = { userData: {} }; +const getKeysFromApiUserDataResponse = payload => { + const newUser = {}; + if (!payload) return newUser; + USER_DATA_PROPERTIES.forEach(prop => { + if (payload[prop] !== undefined) newUser[prop] = payload[prop]; + }); + return newUser; +}; + function appReducer(state = initialState, action) { let displaySettings = { ...state.displaySettings }; let navigationSettings = { ...state.navigationSettings }; @@ -147,7 +157,7 @@ function appReducer(state = initialState, action) { isFirstVisit: false, displaySettings, navigationSettings, - userData: action.payload || {} + userData: getKeysFromApiUserDataResponse(action.payload) }; case LOGOUT: return { @@ -157,7 +167,7 @@ function appReducer(state = initialState, action) { case UPDATE_USER_DATA: return { ...state, - userData: action.userData + userData: getKeysFromApiUserDataResponse(action.userData) }; case SET_UNLOGGED_USER_LOCATION: return { diff --git a/src/components/Board/Board.actions.js b/src/components/Board/Board.actions.js index 9c11e2578..9e0990bb0 100644 --- a/src/components/Board/Board.actions.js +++ b/src/components/Board/Board.actions.js @@ -123,9 +123,12 @@ export function changeDefaultBoard(selectedBoardNameOnJson) { return initialDefaultBoardsIncluded; }; - const defaultBoardsIncluded = - activeCommunicator.defaultBoardsIncluded || - fallbackInitialDefaultBoardsIncluded(activeCommunicator); + const hasValidDefaultBoardsIncluded = !!activeCommunicator + .defaultBoardsIncluded?.length; + + const defaultBoardsIncluded = hasValidDefaultBoardsIncluded + ? activeCommunicator.defaultBoardsIncluded + : fallbackInitialDefaultBoardsIncluded(activeCommunicator); const defaultBoardsNamesIncluded = defaultBoardsIncluded?.map( includedBoardObject => includedBoardObject.nameOnJSON diff --git a/src/components/Communicator/Communicator.actions.js b/src/components/Communicator/Communicator.actions.js index 5dec5e3a0..f575f8afc 100644 --- a/src/components/Communicator/Communicator.actions.js +++ b/src/components/Communicator/Communicator.actions.js @@ -214,7 +214,10 @@ export function verifyAndUpsertCommunicator( updatedCommunicatorData.id = shortid.generate(); updatedCommunicatorData.boards = [...communicator.boards]; - if (!!communicator.defaultBoardsIncluded) { + const hasValidDefaultBoardsIncluded = !!communicator.defaultBoardsIncluded + ?.length; + + if (hasValidDefaultBoardsIncluded) { updatedCommunicatorData.defaultBoardsIncluded = communicator.defaultBoardsIncluded.map( item => ({ ...item }) ); diff --git a/src/components/Communicator/Communicator.reducer.js b/src/components/Communicator/Communicator.reducer.js index 5b19818b2..7c6ec7130 100644 --- a/src/components/Communicator/Communicator.reducer.js +++ b/src/components/Communicator/Communicator.reducer.js @@ -165,7 +165,11 @@ function communicatorReducer(state = initialState, action) { nameOnJSON: 'advanced', homeBoard: 'root' }; - const defaultBoardsIncluded = activeCommunicator.defaultBoardsIncluded + + const hasValidDefaultBoardsIncluded = !!activeCommunicator + .defaultBoardsIncluded?.length; + + const defaultBoardsIncluded = hasValidDefaultBoardsIncluded ? [ ...activeCommunicator.defaultBoardsIncluded, action.defaultBoardData