Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: pr feedback

IgorHorta7a198df344e3
diff --git a/.github/PR_DESCRIPTION.md b/.github/PR_DESCRIPTION.md
deleted file mode 100644
index c1d076e7dd..0000000000
--- a/.github/PR_DESCRIPTION.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## Context
-
-<!-- What problem does this solve? What was the behavior before, and what is it now? Add all relevant context. Link related issues/tickets. -->
-
-## Screenshots
-
-<!-- If UI/UX changes, add screenshots or videos. Delete if not applicable. -->
-
-## Steps to verify the change
-
-## Type
-
-- [ ] Fix
-- [ ] Feature
-- [ ] Improvement
-- [ ] Breaking
-- [ ] Docs
-- [ ] Chore
-
-## Checklist
-
-- [ ] Title follows the [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) format: `type(scope): short description` (scope is optional, e.g., `fix: prevent crash on sync` or `fix(api): handle null response`).
-- [ ] Tested locally
-- [ ] Updated docs (if needed)
-- [ ] Read the [contributing guide](https://infisical.com/docs/contributing/getting-started/overview)
diff --git a/backend/src/ee/services/group/group-service.ts b/backend/src/ee/services/group/group-service.ts
index 4a09114256..d30d6c64fb 100644
--- a/backend/src/ee/services/group/group-service.ts
+++ b/backend/src/ee/services/group/group-service.ts
@@ -259,36 +259,25 @@ export const groupServiceFactory = ({
}
const updatedGroup = await groupDAL.transaction(async (tx): Promise<TGroups> => {
- let updated: TGroups = group;
-
- if (!isInherited && (name || slug)) {
- if (name) {
- const existingGroup = await groupDAL.findOne({ orgId: actorOrgId, name }, tx);
-
- if (existingGroup && existingGroup.id !== id) {
- throw new BadRequestError({
- message: `Failed to update group with name '${name}'. Group with the same name already exists`
- });
- }
+ if (!isInherited && (name || slug) && name) {
+ const existingGroup = await groupDAL.findOne({ orgId: actorOrgId, name }, tx);
+ if (existingGroup && existingGroup.id !== id) {
+ throw new BadRequestError({
+ message: `Failed to update group with name '${name}'. Group with the same name already exists`
+ });
}
-
- const updateResult = await groupDAL.update(
- { id: group.id },
- {
- name,
- slug: slug ? slugify(slug) : undefined
- },
- tx
- );
- const updatedRow = updateResult[0];
- if (updatedRow) updated = updatedRow;
}
+ const [nameSlugRow] =
+ !isInherited && (name || slug)
+ ? await groupDAL.update({ id: group.id }, { name, slug: slug ? slugify(slug) : undefined }, tx)
+ : [];
+
if (role) {
const membership = await membershipGroupDAL.findOne(
{
scope: AccessScope.Organization,
- actorGroupId: updated.id,
+ actorGroupId: group.id,
scopeOrgId: actorOrgId
},
tx
@@ -307,7 +296,7 @@ export const groupServiceFactory = ({
);
}
- return updated;
+ return nameSlugRow ?? group;
});
return updatedGroup;