-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add redirect to enterprise learner dashboard #1251
Conversation
dab267e
to
7166020
Compare
When a learner tries to load the B2C course page for a course that starts in the future (error_code="course_not_started"), normally the learning MFE automatically redirects to the B2C dashboard. This change supports an alternate error_code "course_not_started_enterprise_learner" to trigger an alternative redirect to the B2B (enterprise) learner dashboard. This does two main things: 1. When the course metadata API response indicates course_access.error_code = "course_not_started_enterprise_learner" then redirect to "/redirect/enterprise-learner-dashboard". 2. When the top-level router matches path "/redirect/enterprise-learner-dashboard" then redirec to to the value of config `ENTERPRISE_LEARNER_PORTAL_URL`. ENT-8078
7166020
to
d0d63df
Compare
// Force all tests to run in UTC to prevent tests from being sensitive to host timezone. | ||
module.exports = async () => { | ||
process.env.TZ = 'UTC'; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spent 25 minutes scratching my head on a failing js test until I realized it was sensitive to the time zone of the host machine, and running TZ=UTC npm run test
fixed it. This addition causes all tests to always run in UTC, regardless of host TZ.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, does setting process.env.TZ
in the existing setupTest.js
file work (in an attempt to avoid needing to setup the globalSetup
config).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it would have! I figured just do it for the whole project but happy to revert back to just doing it for one test class if you feel like it's too heavy-handed. This was the failing test (date off by one day):
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1251 +/- ##
==========================================
+ Coverage 87.97% 87.98% +0.01%
==========================================
Files 276 276
Lines 4739 4745 +6
Branches 1194 1196 +2
==========================================
+ Hits 4169 4175 +6
Misses 554 554
Partials 16 16 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes LGTM (with 1 non-blocking question). Defer to any of Jansen's feedback, if any; otherwise, ✅
// Force all tests to run in UTC to prevent tests from being sensitive to host timezone. | ||
module.exports = async () => { | ||
process.env.TZ = 'UTC'; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, does setting process.env.TZ
in the existing setupTest.js
file work (in an attempt to avoid needing to setup the globalSetup
config).
When a learner tries to load the B2C course page for a course that starts in the future (error_code="course_not_started"), normally the learning MFE automatically redirects to the B2C dashboard. This change supports an alternate error_code "course_not_started_enterprise_learner" to trigger an alternative redirect to the B2B (enterprise) learner dashboard.
This does two main things:
ENTERPRISE_LEARNER_PORTAL_URL
.ENT-8078
Companion PR to create the new
course_not_started_enterprise_learner
error code: openedx/edx-platform#33913