Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
1189580e
Commit
1189580e
authored
4 years ago
by
stvn
Browse files
Options
Downloads
Plain Diff
Merge PR #24521 cleanup/mfe-flags
* Commits: Consolidate MFE redirect logic
parents
fb6786d9
9e31d65a
No related branches found
Branches containing commit
Tags
release-2018-12-12-12.20
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/courseware/toggles.py
+0
-8
0 additions, 8 deletions
lms/djangoapps/courseware/toggles.py
lms/djangoapps/courseware/views/index.py
+14
-11
14 additions, 11 deletions
lms/djangoapps/courseware/views/index.py
with
14 additions
and
19 deletions
lms/djangoapps/courseware/toggles.py
+
0
−
8
View file @
1189580e
...
...
@@ -37,11 +37,3 @@ REDIRECT_TO_COURSEWARE_MICROFRONTEND = ExperimentWaffleFlag(WAFFLE_FLAG_NAMESPAC
# .. toggle_tickets: TNL-6982
# .. toggle_status: supported
COURSEWARE_MICROFRONTEND_COURSE_TEAM_PREVIEW
=
CourseWaffleFlag
(
WAFFLE_FLAG_NAMESPACE
,
'
microfrontend_course_team_preview
'
)
def
should_redirect_to_courseware_microfrontend
(
course_key
):
return
(
settings
.
FEATURES
.
get
(
'
ENABLE_COURSEWARE_MICROFRONTEND
'
)
and
(
not
course_key
.
deprecated
)
and
# Old Mongo courses not supported
REDIRECT_TO_COURSEWARE_MICROFRONTEND
.
is_enabled
(
course_key
)
)
This diff is collapsed.
Click to expand it.
lms/djangoapps/courseware/views/index.py
+
14
−
11
View file @
1189580e
...
...
@@ -74,7 +74,6 @@ from ..permissions import MASQUERADE_AS_STUDENT
from
..toggles
import
(
COURSEWARE_MICROFRONTEND_COURSE_TEAM_PREVIEW
,
REDIRECT_TO_COURSEWARE_MICROFRONTEND
,
should_redirect_to_courseware_microfrontend
,
)
from
..url_helpers
import
get_microfrontend_url
...
...
@@ -186,16 +185,20 @@ class CoursewareIndex(View):
Redirect to the new courseware micro frontend,
unless this is a time limited exam.
"""
# learners should redirect, if the waffle flag is set
if
should_redirect_to_courseware_microfrontend
(
self
.
course_key
):
# but exams should not redirect to the mfe until they're supported
if
getattr
(
self
.
section
,
'
is_time_limited
'
,
False
):
return
# and staff will not redirect, either
if
self
.
is_staff
:
return
# DENY: feature disabled globally
if
not
settings
.
FEATURES
.
get
(
'
ENABLE_COURSEWARE_MICROFRONTEND
'
):
return
# DENY: staff access
if
self
.
is_staff
:
return
# DENY: Old Mongo courses, until removed from platform
if
self
.
course_key
.
deprecated
:
return
# DENY: Timed Exams, until supported
if
getattr
(
self
.
section
,
'
is_time_limited
'
,
False
):
return
# ALLOW: when flag set for course
if
REDIRECT_TO_COURSEWARE_MICROFRONTEND
.
is_enabled
(
self
.
course_key
):
raise
Redirect
(
self
.
microfrontend_url
)
@property
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment