fix: certification to private on private timeline (#45562)

Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com>
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Shaun Hamilton
2022-09-29 00:00:22 +05:30
committed by GitHub
co-authored by Naomi Carrigan Oliver Eyton-Williams
parent 926dd9839a
commit 73c3edb56a
5 changed files with 17 additions and 1 deletions
+13 -1
View File
@@ -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(
@@ -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.",
@@ -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',
@@ -130,6 +130,7 @@ function PrivacySettings({
/>
<ToggleSetting
action={t('settings.labels.my-timeline')}
explain={t('settings.disabled')}
flag={!privacyValues['showTimeLine']}
flagName='showTimeLine'
offLabel={t('buttons.public')}
+1
View File
@@ -44,6 +44,7 @@ const toneUrls = {
[FlashMessages.ReportSent]: CHAL_COMP,
[FlashMessages.SigninSuccess]: CHAL_COMP,
[FlashMessages.StartProjectErr]: TRY_AGAIN,
[FlashMessages.TimelinePrivate]: TRY_AGAIN,
[FlashMessages.TokenDeleted]: CHAL_COMP,
[FlashMessages.UpdatedPreferences]: CHAL_COMP,
[FlashMessages.UsernameNotFound]: TRY_AGAIN,