From bbc0eebe91a67cfbd96dd13063347cdce9d1a0a3 Mon Sep 17 00:00:00 2001 From: Biswajeet Das Date: Wed, 8 May 2024 16:03:15 +0530 Subject: [PATCH 1/2] fix: remove hostlist --- .../src/app/organization/dtos/update-branding-details.dto.ts | 3 +-- apps/api/src/app/user/dtos/update-profile-request.dto.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/api/src/app/organization/dtos/update-branding-details.dto.ts b/apps/api/src/app/organization/dtos/update-branding-details.dto.ts index 7dabb11ccbc..7170306c5af 100644 --- a/apps/api/src/app/organization/dtos/update-branding-details.dto.ts +++ b/apps/api/src/app/organization/dtos/update-branding-details.dto.ts @@ -3,13 +3,12 @@ import { IsImageUrl } from '../../shared/validators/image.validator'; const environments = ['production', 'test']; const protocols = environments.includes(process.env.NODE_ENV) ? ['https'] : ['http', 'https']; -const hostWhitelist = environments.includes(process.env.NODE_ENV) ? undefined : ['localhost', 'web.novu.co']; export class UpdateBrandingDetailsDto { @IsUrl({ require_protocol: true, protocols, - host_whitelist: hostWhitelist, + require_tld: false, }) @IsImageUrl({ message: 'Logo must be a valid image URL with one of the following extensions: jpg, jpeg, png, gif, svg', diff --git a/apps/api/src/app/user/dtos/update-profile-request.dto.ts b/apps/api/src/app/user/dtos/update-profile-request.dto.ts index e8dedda565c..d14b38a8ef0 100644 --- a/apps/api/src/app/user/dtos/update-profile-request.dto.ts +++ b/apps/api/src/app/user/dtos/update-profile-request.dto.ts @@ -5,7 +5,6 @@ import type { IUpdateUserProfile } from '@novu/shared'; import { IsImageUrl } from '../../shared/validators/image.validator'; const protocols = process.env.NODE_ENV === 'production' ? ['https'] : ['http', 'https']; -const hostWhitelist = ['production', 'test'].includes(process.env.NODE_ENV) ? undefined : ['localhost', 'web.novu.co']; export class UpdateProfileRequestDto implements IUpdateUserProfile { @ApiProperty() @@ -18,7 +17,7 @@ export class UpdateProfileRequestDto implements IUpdateUserProfile { @IsUrl({ require_protocol: true, protocols, - host_whitelist: hostWhitelist, + require_tld: false, }) @IsImageUrl({ message: 'Logo must be a valid image URL with one of the following extensions: jpg, jpeg, png, gif, svg', From cf6319f4cab1f9a45d1e7003feba9e9beefd0924 Mon Sep 17 00:00:00 2001 From: Biswajeet Das Date: Wed, 8 May 2024 20:42:57 +0530 Subject: [PATCH 2/2] fix: make form dirty when image is uploaded --- apps/web/src/pages/brand/tabs/v2/BrandLogoUpload.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/pages/brand/tabs/v2/BrandLogoUpload.tsx b/apps/web/src/pages/brand/tabs/v2/BrandLogoUpload.tsx index 8a01068df7e..c3fa15acc01 100644 --- a/apps/web/src/pages/brand/tabs/v2/BrandLogoUpload.tsx +++ b/apps/web/src/pages/brand/tabs/v2/BrandLogoUpload.tsx @@ -25,7 +25,7 @@ export function BrandLogoUpload({ field, setValue }: BrandLogoUploadProps) { const { uploadToStorage } = useUploadToStorage({ onSuccess: (path) => { - setValue('logo', path); + setValue('logo', path, { shouldDirty: true }); }, onError: (e) => { errorMessage('Failed to upload branding image: ' + e.message);