Skip to content

Commit efcafdf

Browse files
authored
fix(webapp): filter dev environments by userId in OrganizationsPresenter (#3273)
fix: filter dev environments by userId in OrganizationsPresenter
1 parent 97d2f72 commit efcafdf

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
Fix `OrganizationsPresenter.#getEnvironment` matching the wrong development environment on teams with multiple members. All dev environments share the slug `"dev"`, so the previous `find` by slug alone could return another member's environment. Now filters DEVELOPMENT environments by `orgMember.userId` to ensure the logged-in user's dev environment is selected.

apps/webapp/app/presenters/OrganizationsPresenter.server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ export class OrganizationsPresenter {
210210
})[];
211211
}) {
212212
if (environmentSlug) {
213-
const env = environments.find((e) => e.slug === environmentSlug);
213+
const env = environments.find(
214+
(e) =>
215+
e.slug === environmentSlug &&
216+
(e.type !== "DEVELOPMENT" || e.orgMember?.userId === user.id)
217+
);
214218
if (env) {
215219
return env;
216220
}

0 commit comments

Comments
 (0)