Merge pull request #26154 from edx/saad/TNL-7361-followup

[TNL-7361] - Fix for instructor tab visible in learner role when masquerading.
This commit is contained in:
Saad Yousaf
2021-01-29 17:31:28 +05:00
committed by GitHub

View File

@@ -4,6 +4,7 @@
<%namespace name='static' file='/static_content.html'/>
<%!
from lms.djangoapps.courseware.masquerade import is_masquerading_as_student
from lms.djangoapps.courseware.tabs import get_course_tab_list
from django.conf import settings
from django.urls import reverse
@@ -21,6 +22,8 @@ if course is not None:
settings.FEATURES.get('ENABLE_SPECIAL_EXAMS', False) and
(course.enable_proctored_exams or course.enable_timed_exams)
)
masquerading_as_student = is_masquerading_as_student(request.user, course.id)
%>
% if include_special_exams is not UNDEFINED and include_special_exams:
@@ -44,19 +47,23 @@ if course is not None:
<%
tab_is_active = tab.tab_id in (active_page, default_tab)
%>
<li class="nav-item ${'active' if tab_is_active else ''}">
<a href="${tab.link_func(course, reverse)}" class="nav-link">
${_(tab.name)}
% if tab_is_active:
<span class="sr-only">, ${_('current location')}</span>
%endif
% if tab_image:
## Translators: 'needs attention' is an alternative string for the
## notification image that indicates the tab "needs attention".
<img src="${tab_image}" alt="${_('needs attention')}" />
%endif
</a>
</li>
% if tab.name == 'Instructor' and masquerading_as_student:
<% continue %>
% else:
<li class="nav-item ${'active' if tab_is_active else ''}">
<a href="${tab.link_func(course, reverse)}" class="nav-link">
${_(tab.name)}
% if tab_is_active:
<span class="sr-only">, ${_('current location')}</span>
%endif
% if tab_image:
## Translators: 'needs attention' is an alternative string for the
## notification image that indicates the tab "needs attention".
<img src="${tab_image}" alt="${_('needs attention')}" />
%endif
</a>
</li>
%endif
% endfor
</ul>
</nav>