2019-12-05 13:57:00 +01:00
|
|
|
export function selectBoardByUserProjects(boardsByID, projectsByName) {
|
|
|
|
const userProjects = Object.keys(projectsByName);
|
|
|
|
return Object.keys(boardsByID).reduce((filteredBoardsByID, boardID) => {
|
|
|
|
const board = boardsByID[boardID];
|
2019-12-13 13:31:50 +01:00
|
|
|
const hasProject = board.projects.length === 0 || board.projects.some(p => userProjects.indexOf(p) !== -1);
|
2019-12-05 13:57:00 +01:00
|
|
|
if (hasProject) {
|
|
|
|
filteredBoardsByID[boardID] = board;
|
|
|
|
}
|
|
|
|
return filteredBoardsByID;
|
|
|
|
}, {});
|
|
|
|
}
|