From 07c903c2575b35ff1734ba4ebc3bc48637bc746d Mon Sep 17 00:00:00 2001 From: Bianca Severino Date: Mon, 5 Apr 2021 12:45:22 -0400 Subject: [PATCH] fix: add username to proctoring info panel view This allows course staff to view a specific learner's onboarding status while masquerading. --- CHANGELOG.rst | 6 +++++ edx_proctoring/__init__.py | 2 +- .../js/views/proctored_exam_info.js | 4 +++ .../spec/proctored_exam_info_spec.js | 27 +++++++++++++++++++ package.json | 2 +- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2b520563bf4..ed8643c0fbd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,12 @@ Change Log Unreleased ~~~~~~~~~~ + +[3.8.4] - 2021-04-05 +~~~~~~~~~~~~~~~~~~~~~ +* Add the request username to the proctoring info panel, allowing course staff to masquerade as + a specific user. + [3.8.3] - 2021-04-05 ~~~~~~~~~~~~~~~~~~~~~ * Use exam due_date or course end date to evaluate the visibility of the onboarding status panel diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index a1102f45889..d4e7e4fc89b 100644 --- a/edx_proctoring/__init__.py +++ b/edx_proctoring/__init__.py @@ -3,6 +3,6 @@ """ # Be sure to update the version number in edx_proctoring/package.json -__version__ = '3.8.3' +__version__ = '3.8.4' default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name diff --git a/edx_proctoring/static/proctoring/js/views/proctored_exam_info.js b/edx_proctoring/static/proctoring/js/views/proctored_exam_info.js index 947b52ae2c3..86db4262390 100644 --- a/edx_proctoring/static/proctoring/js/views/proctored_exam_info.js +++ b/edx_proctoring/static/proctoring/js/views/proctored_exam_info.js @@ -63,7 +63,11 @@ edx.courseware.proctored_exam.ProctoredExamInfo = Backbone.View.extend({ initialize: function() { this.course_id = this.$el.data('course-id'); + this.username = this.$el.data('username'); this.model.url = this.model.url + '?course_id=' + encodeURIComponent(this.course_id); + if (this.username) { + this.model.url = this.model.url + '&username=' + encodeURIComponent(this.username); + } this.template_url = '/static/proctoring/templates/proctored-exam-info.underscore'; this.status = ''; diff --git a/edx_proctoring/static/proctoring/spec/proctored_exam_info_spec.js b/edx_proctoring/static/proctoring/spec/proctored_exam_info_spec.js index 054e4dd1fae..d2b0a4e3dab 100644 --- a/edx_proctoring/static/proctoring/spec/proctored_exam_info_spec.js +++ b/edx_proctoring/static/proctoring/spec/proctored_exam_info_spec.js @@ -128,6 +128,33 @@ describe('ProctoredExamInfo', function() { .toHaveLength(0); }); + it('should render if username is provided', function() { + setFixtures( + '
' + ); + this.server.respondWith( + 'GET', + '/api/edx_proctoring/v1/user_onboarding/status?course_id=test_course_id&username=test_username', + [ + 200, + { + 'Content-Type': 'application/json' + }, + JSON.stringify(expectedProctoredExamInfoJson('verified')) + ] + ); + + this.proctored_exam_info = new edx.courseware.proctored_exam.ProctoredExamInfo({ + el: $('.proctoring-info-panel'), + model: new LearnerOnboardingModel() + }); + this.server.respond(); + this.server.respond(); + expect(this.proctored_exam_info.$el.find('.onboarding-status').html()) + .toContain('Verified'); + }); + it('should not render proctoring info panel for exam with 404 response', function() { this.server.respondWith('GET', '/api/edx_proctoring/v1/user_onboarding/status?course_id=test_course_id', [ diff --git a/package.json b/package.json index 8fe2d4dce44..90c7b1111bc 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@edx/edx-proctoring", "//": "Be sure to update the version number in edx_proctoring/__init__.py", "//": "Note that the version format is slightly different than that of the Python version when using prereleases.", - "version": "3.8.3", + "version": "3.8.4", "main": "edx_proctoring/static/index.js", "scripts":{ "test":"gulp test"