Skip to content

Commit

Permalink
fix: Restrict site transfer sites to projects where user is manager
Browse files Browse the repository at this point in the history
  • Loading branch information
David Code Howard committed Feb 7, 2024
1 parent 8ba0502 commit 4ff2018
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit 4ff2018

Please sign in to comment.