From 73c3edb56a876ea99bd3ad04daff99d06391ef68 Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Wed, 28 Sep 2022 19:30:22 +0100 Subject: [PATCH] fix: certification to private on private timeline (#45562) Co-authored-by: Naomi Carrigan Co-authored-by: Oliver Eyton-Williams --- api-server/src/server/boot/certificate.js | 14 +++++++++++++- client/i18n/locales/english/translations.json | 1 + .../src/components/Flash/redux/flash-messages.ts | 1 + client/src/components/settings/privacy.tsx | 1 + client/src/utils/tone/index.ts | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/api-server/src/server/boot/certificate.js b/api-server/src/server/boot/certificate.js index 7f9bec823e8..65972153647 100644 --- a/api-server/src/server/boot/certificate.js +++ b/api-server/src/server/boot/certificate.js @@ -391,7 +391,7 @@ function createShowCert(app) { ] }); } - const { isLocked, showCerts, showName } = user.profileUI; + const { isLocked, showCerts, showName, showTimeLine } = user.profileUI; if (!user.name) { return res.json({ @@ -451,6 +451,18 @@ function createShowCert(app) { }); } + if (!showTimeLine) { + return res.json({ + messages: [ + { + type: 'info', + message: 'flash.timeline-private', + variables: { username: username } + } + ] + }); + } + if (user[certType]) { const { completedChallenges = [] } = user; const certChallenge = _.find( diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index 13bf603c3a9..4ea0efc23d8 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -556,6 +556,7 @@ "complete-project-first": "You must complete the project first.", "local-code-save-error": "Oops, your code did not save, your browser's local storage may be full.", "local-code-saved": "Saved! Your code was saved to your browser's local storage.", + "timeline-private": "{{username}} has chosen to make their timeline private. They will need to make their timeline public in order for others to be able to view their certification.", "code-saved": "Your code was saved to the database. It will be here when you return.", "code-save-error": "An error occurred trying to save your code.", "code-save-less": "Slow Down! Your code was not saved. Try again in a few seconds.", diff --git a/client/src/components/Flash/redux/flash-messages.ts b/client/src/components/Flash/redux/flash-messages.ts index ad74e91701e..871b531abb8 100644 --- a/client/src/components/Flash/redux/flash-messages.ts +++ b/client/src/components/Flash/redux/flash-messages.ts @@ -29,6 +29,7 @@ export enum FlashMessages { ReportSent = 'flash.report-sent', SigninSuccess = 'flash.signin-success', StartProjectErr = 'flash.start-project-err', + TimelinePrivate = 'flash.timeline-private', TokenDeleted = 'flash.token-deleted', UpdatedPreferences = 'flash.updated-preferences', UsernameNotFound = 'flash.username-not-found', diff --git a/client/src/components/settings/privacy.tsx b/client/src/components/settings/privacy.tsx index 5c1f551d7de..35e3e5d1015 100644 --- a/client/src/components/settings/privacy.tsx +++ b/client/src/components/settings/privacy.tsx @@ -130,6 +130,7 @@ function PrivacySettings({ />