Skip to content

Commit bb577ef

Browse files
committed
Batch list: only allow environments that are part of this project
1 parent aab3204 commit bb577ef

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

apps/webapp/app/presenters/v3/BatchListPresenter.server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ export class BatchListPresenter extends BasePresenter {
8181

8282
let environmentIds = project.environments.map((e) => e.id);
8383
if (environments && environments.length > 0) {
84-
environmentIds = environments;
84+
//if environments are passed in, we only include them if they're in the project
85+
environmentIds = environments.filter((e) => project.environments.some((pe) => pe.id === e));
86+
}
87+
88+
if (environmentIds.length === 0) {
89+
throw new Error("No matching environments found for the project");
8590
}
8691

8792
const periodMs = period ? parse(period) : undefined;

0 commit comments

Comments
 (0)