feat: added flag to access course live in learning mfe

This commit is contained in:
adeel.tajamul
2022-04-15 09:17:45 +05:00
parent a099d9a10b
commit f48cc56e04
3 changed files with 10 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ from lms.djangoapps.courseware.tabs import EnrolledTab
from openedx.core.djangoapps.course_live.config.waffle import ENABLE_COURSE_LIVE
from openedx.core.djangoapps.course_live.models import CourseLiveConfiguration
from openedx.core.lib.cache_utils import request_cached
from openedx.features.course_experience.url_helpers import get_learning_mfe_home_url
from openedx.features.lti_course_tab.tab import LtiCourseLaunchMixin
@@ -28,6 +29,13 @@ class CourseLiveTab(LtiCourseLaunchMixin, TabFragmentViewMixin, EnrolledTab):
'instructor': 'Administrator',
}
@property
def link_func(self):
def _link_func(course, reverse_func):
return get_learning_mfe_home_url(course_key=course.id, url_fragment='live')
return _link_func
@request_cached()
def _get_lti_config(self, course: CourseBlock) -> LtiConfiguration:
"""

View File

@@ -33,7 +33,7 @@ class CourseLiveTabTestCase(TabTestCase):
lti_1p1_client_secret='test_client_secret',
)
self.course_live_config.save()
self.url = self.reverse('course_tab_view', args=[str(self.course.id), CourseLiveTab.type])
self.url = f"http://learning-mfe/course/{str(self.course.id)}/live"
def check_course_live_tab(self):
"""

View File

@@ -234,7 +234,7 @@ class TestCourseLiveConfigurationView(ModuleStoreTestCase, APITestCase):
self.assertEqual(data, {
'tab_id': 'lti_live',
'title': 'Live',
'url': f'http://testserver/courses/{self.course.id}/tab/lti_live/'
'url': f'http://learning-mfe/course/{self.course.id}/live'
})