Fix k5 detail view for multi role teachers

Teachers that are also students should not get the
K5 detail view.

fixes LS-2387
flag=none

Test plan:
- Have a user that is enrolled in a k5 subject course as
  both a student and a teacher
- View the subject course and click Manage Subject
- The course nav should be visible

Change-Id: I7b2c381a61418cd95c5f911c3ae9f151bb7b8a03
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270149
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Nate Armstrong <narmstrong@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
This commit is contained in:
Nate Armstrong 2021-07-28 08:21:55 -06:00
parent 7749bd333c
commit 6ea4fb907b
2 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ module K5Mode
# context is not a k5 course. Intended for use on pages that are not in a course context (like the courses index)
def set_k5_mode(require_k5_theme: false)
# Only students should see the details view
@k5_details_view = @context.try(:elementary_subject_course?) && @context.grants_right?(@current_user, :participate_as_student)
@k5_details_view = @context.try(:elementary_subject_course?) && !@context.grants_right?(@current_user, :read_as_admin)
if @context.try(:elementary_subject_course?)
@show_left_side = !@k5_details_view
end

View File

@ -67,7 +67,7 @@ describe K5Mode do
context 'that is also a student' do
before :each do
@course.enroll_user(@teacher, 'StudentEnrollment')
@course.enroll_user(@teacher, 'StudentEnrollment', enrollment_state: 'active')
end
it_behaves_like ':show_left_side'