Commit d322e326 by Matt Tuchfarber

Hide if not available

parent 8b225210
...@@ -1678,11 +1678,9 @@ def enter_chat(request, course_id): ...@@ -1678,11 +1678,9 @@ def enter_chat(request, course_id):
lms_user = request.user lms_user = request.user
rocketchat = RocketWrap('apiuser', 'apipassword', server_url=SERVER_DOMAIN, ssl_verify=False) rocketchat = RocketWrap('apiuser', 'apipassword', server_url=SERVER_DOMAIN, ssl_verify=False)
full_name = lms_user.get_full_name() if lms_user.get_full_name() else "_" full_name = lms_user.get_full_name() if lms_user.get_full_name() else "_"
formatted_course_id = re.sub('[^0-9a-zA-Z]+', '_', course_id)
if not rocketchat.get_group(formatted_course_id): if not rocketchat.get_group(course_id):
rocketchat.create_new_group(formatted_course_id) rocketchat.create_new_group(course_id)
rc_user = rocketchat.get_or_create_user( rc_user = rocketchat.get_or_create_user(
lms_user.email, lms_user.email,
......
...@@ -112,12 +112,13 @@ from openedx.core.djangolib.markup import HTML, Text ...@@ -112,12 +112,13 @@ from openedx.core.djangolib.markup import HTML, Text
</div> </div>
</div> </div>
</main> </main>
% if course._deprecated_per_instance_field_data._kvs._fields['enable_rocket_chat']
<script> <script>
var full_url = window.location.protocol + '//' + window.location.host + '/courses/${course_id}/chat'; var full_url = window.location.protocol + '//' + window.location.host + '/courses/${course_id}/chat';
tab_list = document.querySelector('.course-tabs'); tab_list = document.querySelector('.course-tabs');
tab_list.innerHTML = tab_list.innerHTML + '<li class="tab"><a href="' + full_url + '">Chat</a></li>'; tab_list.innerHTML = tab_list.innerHTML + '<li class="tab"><a href="' + full_url + '">Chat</a></li>';
</script> </script>
% endif
<%static:require_module_async module_name="js/dateutil_factory" class_name="DateUtilFactory"> <%static:require_module_async module_name="js/dateutil_factory" class_name="DateUtilFactory">
DateUtilFactory.transform(iterationKey=".localized-datetime"); DateUtilFactory.transform(iterationKey=".localized-datetime");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment