fix(webapp): filter dev environments by userId in OrganizationsPresenter (#3273)
fix: filter dev environments by userId in OrganizationsPresenter
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
area: webapp
|
||||
type: fix
|
||||
---
|
||||
|
||||
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.
|
||||
@@ -210,7 +210,11 @@ export class OrganizationsPresenter {
|
||||
})[];
|
||||
}) {
|
||||
if (environmentSlug) {
|
||||
const env = environments.find((e) => e.slug === environmentSlug);
|
||||
const env = environments.find(
|
||||
(e) =>
|
||||
e.slug === environmentSlug &&
|
||||
(e.type !== "DEVELOPMENT" || e.orgMember?.userId === user.id)
|
||||
);
|
||||
if (env) {
|
||||
return env;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user