From 44dc169ecac0963ba2461c845458186226330359 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Wed, 16 May 2018 16:21:14 -0400 Subject: [PATCH] Display error message if account is inactive. --- .../StudentAccountDeletionInitializer.js | 2 +- .../components/StudentAccountDeletion.jsx | 22 ++++++++++++++----- .../student_account/account_settings.html | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lms/static/js/student_account/StudentAccountDeletionInitializer.js b/lms/static/js/student_account/StudentAccountDeletionInitializer.js index 4f1b42174d..5637e9e2d5 100644 --- a/lms/static/js/student_account/StudentAccountDeletionInitializer.js +++ b/lms/static/js/student_account/StudentAccountDeletionInitializer.js @@ -16,7 +16,7 @@ const wrapperRendered = setInterval(() => { component: StudentAccountDeletion, selector: `#${accountDeletionWrapperId}`, componentName: 'StudentAccountDeletion', - props: { socialAccountLinks: window.auth }, + props: { socialAccountLinks: window.auth, isActive: window.isActive }, }); } diff --git a/lms/static/js/student_account/components/StudentAccountDeletion.jsx b/lms/static/js/student_account/components/StudentAccountDeletion.jsx index 55e20d36b4..f71e9f9917 100644 --- a/lms/static/js/student_account/components/StudentAccountDeletion.jsx +++ b/lms/static/js/student_account/components/StudentAccountDeletion.jsx @@ -12,7 +12,8 @@ export class StudentAccountDeletion extends React.Component { this.loadDeletionModal = this.loadDeletionModal.bind(this); this.state = { deletionModalOpen: false, - socialAuthConnected: props.socialAccountLinks.providers.reduce((acc, value) => acc || value.connected, false) + socialAuthConnected: props.socialAccountLinks.providers.reduce((acc, value) => acc || value.connected, false), + isActive: props.isActive, }; } @@ -26,7 +27,7 @@ export class StudentAccountDeletion extends React.Component { } render() { - const { deletionModalOpen, socialAuthConnected } = this.state + const { deletionModalOpen, socialAuthConnected, isActive } = this.state const loseAccessText = StringUtils.interpolate( gettext('You may also lose access to verified certificates and other program credentials like MicroMasters certificates. If you want to make a copy of these for your records before proceeding with deletion, follow the instructions for {htmlStart}printing or downloading a certificate{htmlEnd}.'), { @@ -35,6 +36,8 @@ export class StudentAccountDeletion extends React.Component { }, ); + const showError = socialAuthConnected || !isActive; + const socialAuthError = StringUtils.interpolate( gettext('Before proceeding, please {htmlStart}unlink all social media accounts{htmlEnd}.'), { @@ -43,6 +46,14 @@ export class StudentAccountDeletion extends React.Component { } ); + const activationError = StringUtils.interpolate( + gettext('Before proceeding, please {htmlStart}activate your account{htmlEnd}.'), + { + htmlStart: '', + htmlEnd: '', + } + ); + return (

{ gettext('We’re sorry to see you go!') }

@@ -56,19 +67,20 @@ export class StudentAccountDeletion extends React.Component {
)} diff --git a/lms/templates/student_account/account_settings.html b/lms/templates/student_account/account_settings.html index 45928b086c..706c86b3a9 100644 --- a/lms/templates/student_account/account_settings.html +++ b/lms/templates/student_account/account_settings.html @@ -73,7 +73,8 @@ from openedx.features.course_experience import ENABLE_GDPR_COMPAT_FLAG % if ENABLE_GDPR_COMPAT_FLAG.is_enabled_without_course_context(): <%static:webpack entry="StudentAccountDeletionInitializer">