diff --git a/packages/core/src/service/services/role.service.ts b/packages/core/src/service/services/role.service.ts index f551de8bdb..1a1d9f66d6 100644 --- a/packages/core/src/service/services/role.service.ts +++ b/packages/core/src/service/services/role.service.ts @@ -267,7 +267,7 @@ export class RoleService { input.permissions, ); } - const updatedRole = patchEntity(role, { + patchEntity(role, { code: input.code, description: input.description, permissions: input.permissions @@ -275,11 +275,12 @@ export class RoleService { : undefined, }); if (targetChannels) { - updatedRole.channels = targetChannels; + role.channels = targetChannels; } - await this.connection.getRepository(ctx, Role).save(updatedRole, { reload: false }); - await this.eventBus.publish(new RoleEvent(ctx, role, 'updated', input)); - return await assertFound(this.findOne(ctx, role.id)); + await this.connection.getRepository(ctx, Role).save(role, { reload: false }); + const updatedRole = await assertFound(this.findOne(ctx, role.id)); + await this.eventBus.publish(new RoleEvent(ctx, updatedRole, 'updated', input)); + return updatedRole; } async delete(ctx: RequestContext, id: ID): Promise {