diff --git a/src/api/user.ts b/src/api/user.ts index 3fc3f7198..e82f13b75 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -47,6 +47,7 @@ export interface UserDocument { profileVisibility: AllowedProfileVisibility; publicConfig?: { isAvailableForHire: boolean; + isEmailVisible: boolean; headline: string; roadmaps: string[]; customRoadmaps: string[]; @@ -78,11 +79,7 @@ type ProgressResponse = { export type GetPublicProfileResponse = Omit< UserDocument, - | 'password' - | 'verificationCode' - | 'resetPasswordCode' - | 'resetPasswordCodeAt' - | 'email' + 'password' | 'verificationCode' | 'resetPasswordCode' | 'resetPasswordCodeAt' > & { activity: UserActivityCount; roadmaps: ProgressResponse[]; diff --git a/src/components/UpdateProfile/UpdatePublicProfileForm.tsx b/src/components/UpdateProfile/UpdatePublicProfileForm.tsx index acd0e366a..af585091d 100644 --- a/src/components/UpdateProfile/UpdatePublicProfileForm.tsx +++ b/src/components/UpdateProfile/UpdatePublicProfileForm.tsx @@ -30,6 +30,7 @@ export function UpdatePublicProfileForm() { const [publicProfileUrl, setPublicProfileUrl] = useState(''); const [isAvailableForHire, setIsAvailableForHire] = useState(false); + const [isEmailVisible, setIsEmailVisible] = useState(true); const [headline, setHeadline] = useState(''); const [username, setUsername] = useState(''); const [roadmapVisibility, setRoadmapVisibility] = @@ -56,6 +57,7 @@ export function UpdatePublicProfileForm() { `${import.meta.env.PUBLIC_API_URL}/v1-update-public-profile-config`, { isAvailableForHire, + isEmailVisible, profileVisibility, headline, username, @@ -116,6 +118,7 @@ export function UpdatePublicProfileForm() { setRoadmaps(publicConfig?.roadmaps || []); setCustomRoadmapVisibility(publicConfig?.customRoadmapVisibility || 'none'); setIsAvailableForHire(publicConfig?.isAvailableForHire || false); + setIsEmailVisible(publicConfig?.isEmailVisible ?? true); setIsLoading(false); }; @@ -450,6 +453,19 @@ export function UpdatePublicProfileForm() {
+
+ setIsEmailVisible(e.target.checked)} + /> + +
+
@@ -37,6 +38,7 @@ export function UserPublicProfileHeader(props: UserPublicProfileHeaderProps) { )} {links?.twitter && } {links?.website && } + {isEmailVisible && }