Skip to content

Commit

Permalink
BC-7281 - fix redirection to a non-existent page (#3448)
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenWaysDP authored May 8, 2024
1 parent 9b14893 commit 4ee7141
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions controllers/courses.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,21 @@ router.get('/:courseId/usersJson', (req, res, next) => {
// EDITOR

router.get('/:courseId/', async (req, res, next) => {
const allowedActiveTabs = ['tools', 'groups'];
const { activeTab } = req.query;

if (!allowedActiveTabs.includes(activeTab)) {
res.redirect(getDefaultRedirectUrl(req.params.courseId));
return;
}

const FEATURE_CTL_TOOLS_TAB_ENABLED = Configuration.get('FEATURE_CTL_TOOLS_TAB_ENABLED');

if (FEATURE_CTL_TOOLS_TAB_ENABLED && activeTab === 'tools') {
res.redirect(`/rooms/${req.params.courseId}?tab=tools`);
return;
}

const promises = [
api(req).get(`/courses/${req.params.courseId}`),
api(req).get('/lessons/', {
Expand Down

0 comments on commit 4ee7141

Please sign in to comment.