From 4ff2018d6ecca4713bc3f16671311b1912f6bd33 Mon Sep 17 00:00:00 2001 From: David Code Howard Date: Wed, 7 Feb 2024 12:42:16 -0500 Subject: [PATCH] fix: Restrict site transfer sites to projects where user is manager --- src/selectors.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/selectors.ts b/src/selectors.ts index 26f5e9f6..6dc64a50 100644 --- a/src/selectors.ts +++ b/src/selectors.ts @@ -123,11 +123,14 @@ export const selectSitesAndUserRoles = createSelector( ); export const selectProjectsWithTransferrableSites = createSelector( - [selectProjectsWithUserRole, selectSites], - (projects, sites) => { + [selectProjectsWithUserRole, selectSites, selectSitesAndUserRoles], + (projects, sites, sitesWithRoles) => { const projectSites = projects.flatMap(project => Object.keys(project.sites) - .filter(siteId => siteId in project.sites) + .filter( + siteId => + siteId in project.sites && sitesWithRoles[siteId] === 'manager', + ) .map(siteId => { const joinedSite = sites[siteId];