diff --git a/src/lib/features/project/project-owners-read-model.test.ts b/src/lib/features/project/project-owners-read-model.test.ts index eb6055e5715d..831310cc573e 100644 --- a/src/lib/features/project/project-owners-read-model.test.ts +++ b/src/lib/features/project/project-owners-read-model.test.ts @@ -361,25 +361,4 @@ describe('integration tests', () => { { name: projectIdB, owners: [{ ownerType: 'user' }] }, ]); }); - - test('anonymizes emails when asked to', async () => { - const projectId = randomId(); - await db.stores.projectStore.create({ id: projectId, name: projectId }); - - await db.stores.accessStore.addUserToRole( - owner.id, - ownerRoleId, - projectId, - ); - - const owners = await readModel.getAllProjectOwners(true); - expect(owners).toMatchObject({ - [projectId]: [ - { - name: 'Owner Name', - email: expect.stringMatching(/@unleash.run$/), - }, - ], - }); - }); }); diff --git a/src/lib/features/project/project-owners-read-model.ts b/src/lib/features/project/project-owners-read-model.ts index 7f282231f0ac..038b97a67a0f 100644 --- a/src/lib/features/project/project-owners-read-model.ts +++ b/src/lib/features/project/project-owners-read-model.ts @@ -1,6 +1,6 @@ import type { Db } from '../../db/db'; import { RoleName } from '../../types'; -import { anonymise, generateImageUrl } from '../../util'; +import { generateImageUrl } from '../../util'; import type { GroupProjectOwner, IProjectOwnersReadModel, @@ -35,7 +35,6 @@ export class ProjectOwnersReadModel implements IProjectOwnersReadModel { private async getAllProjectUsersByRole( roleId: number, - anonymizeProjectOwners: boolean = false, ): Promise> { const usersResult = await this.db .select( @@ -54,20 +53,13 @@ export class ProjectOwnersReadModel implements IProjectOwnersReadModel { .join(`${T.USERS} as user`, 'ru.user_id', 'user.id'); const usersDict: Record = {}; - const processSensitiveData = anonymizeProjectOwners - ? anonymise - : (x: string) => x; - usersResult.forEach((user) => { const project = user.project as string; const data: UserProjectOwner = { ownerType: 'user', - name: - user?.name || - user?.username || - processSensitiveData(user?.email), - email: processSensitiveData(user?.email), + name: user?.name || user?.username || user?.email, + email: user?.email, imageUrl: generateImageUrl(user), }; @@ -112,16 +104,11 @@ export class ProjectOwnersReadModel implements IProjectOwnersReadModel { return groupsDict; } - async getAllProjectOwners( - anonymizeProjectOwners: boolean = false, - ): Promise { + async getAllProjectOwners(): Promise { const ownerRole = await this.db(T.ROLES) .where({ name: RoleName.OWNER }) .first(); - const usersDict = await this.getAllProjectUsersByRole( - ownerRole.id, - anonymizeProjectOwners, - ); + const usersDict = await this.getAllProjectUsersByRole(ownerRole.id); const groupsDict = await this.getAllProjectGroupsByRole(ownerRole.id); const dict: Record< @@ -142,9 +129,8 @@ export class ProjectOwnersReadModel implements IProjectOwnersReadModel { async addOwners( projects: T[], - anonymizeProjectOwners: boolean = false, ): Promise> { - const owners = await this.getAllProjectOwners(anonymizeProjectOwners); + const owners = await this.getAllProjectOwners(); return ProjectOwnersReadModel.addOwnerData(projects, owners); } diff --git a/src/lib/features/project/project-owners-read-model.type.ts b/src/lib/features/project/project-owners-read-model.type.ts index b8a8faaa0adc..c26536648c1c 100644 --- a/src/lib/features/project/project-owners-read-model.type.ts +++ b/src/lib/features/project/project-owners-read-model.type.ts @@ -28,6 +28,5 @@ export type WithProjectOwners = (T & { export interface IProjectOwnersReadModel { addOwners( projects: T[], - anonymizeProjectOwners?: boolean, ): Promise>; } diff --git a/src/lib/features/project/project-service.ts b/src/lib/features/project/project-service.ts index ac5f16b38621..83b722c1da1f 100644 --- a/src/lib/features/project/project-service.ts +++ b/src/lib/features/project/project-service.ts @@ -258,13 +258,7 @@ export default class ProjectService { async addOwnersToProjects( projects: ProjectForUi[], ): Promise { - const anonymizeProjectOwners = this.flagResolver.isEnabled( - 'anonymizeProjectOwners', - ); - return this.projectOwnersReadModel.addOwners( - projects, - anonymizeProjectOwners, - ); + return this.projectOwnersReadModel.addOwners(projects); } async getProject(id: string): Promise { diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index bf245a5c1df5..9df11056bc8d 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -52,7 +52,6 @@ export type IFlagKey = | 'manyStrategiesPagination' | 'enableLegacyVariants' | 'navigationSidebar' - | 'anonymizeProjectOwners' | 'extendedMetrics' | 'removeUnsafeInlineStyleSrc' | 'originMiddleware' @@ -262,10 +261,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_SIDEBAR_NAVIGATION, true, ), - anonymizeProjectOwners: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_ANONYMIZE_PROJECT_OWNERS, - false, - ), extendedMetrics: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_EXTENDED_METRICS, false,