MDL-75898 assignfeedback_editpdf: Don't poll readonly pages

When requesting the readonly version of pages (which contain
teacher annotations), they should always be available - the
PHP side even throws an exception when they're not. This
means we don't need to worry about polling document converters
from the JS side and can just return the pages immediately.
This commit is contained in:
Cameron Ball 2022-12-13 10:17:25 +08:00 committed by Matthew Hilton
parent 825609ae08
commit 90350915c2
4 changed files with 59 additions and 5 deletions

View File

@ -3780,6 +3780,24 @@ EDITOR.prototype = {
var data = this.handle_response_data(response),
poll = false;
if (data) {
// When we are requesting the readonly version of the pages, they should
// always be available (see document_services::get_page_images_for_attempt)
// so we can just serve them immediately without triggering any document
// conversion or polling.
//
// This is necessary to prevent situations where the student has updated
// their submission and the teacher has annotated a previous version of
// the submission in the assignment grader. In this situation if a student
// views the online version of the annotated PDF ("View annotated PDF" link)
// the readonly pages here and the updated pages (awaiting conversion) will
// never match, and the code endlessly polls.
//
// See also: MDL-45580, MDL-66626, MDL-75898.
if (this.get('readonly') === true) {
this.prepare_pages_for_display(data);
return;
}
this.documentstatus = data.status;
if (data.status === 0) {
// The combined document is still waiting for input to be ready.

View File

@ -3780,6 +3780,24 @@ EDITOR.prototype = {
var data = this.handle_response_data(response),
poll = false;
if (data) {
// When we are requesting the readonly version of the pages, they should
// always be available (see document_services::get_page_images_for_attempt)
// so we can just serve them immediately without triggering any document
// conversion or polling.
//
// This is necessary to prevent situations where the student has updated
// their submission and the teacher has annotated a previous version of
// the submission in the assignment grader. In this situation if a student
// views the online version of the annotated PDF ("View annotated PDF" link)
// the readonly pages here and the updated pages (awaiting conversion) will
// never match, and the code endlessly polls.
//
// See also: MDL-45580, MDL-66626, MDL-75898.
if (this.get('readonly') === true) {
this.prepare_pages_for_display(data);
return;
}
this.documentstatus = data.status;
if (data.status === 0) {
// The combined document is still waiting for input to be ready.

View File

@ -483,6 +483,24 @@ EDITOR.prototype = {
var data = this.handle_response_data(response),
poll = false;
if (data) {
// When we are requesting the readonly version of the pages, they should
// always be available (see document_services::get_page_images_for_attempt)
// so we can just serve them immediately without triggering any document
// conversion or polling.
//
// This is necessary to prevent situations where the student has updated
// their submission and the teacher has annotated a previous version of
// the submission in the assignment grader. In this situation if a student
// views the online version of the annotated PDF ("View annotated PDF" link)
// the readonly pages here and the updated pages (awaiting conversion) will
// never match, and the code endlessly polls.
//
// See also: MDL-45580, MDL-66626, MDL-75898.
if (this.get('readonly') === true) {
this.prepare_pages_for_display(data);
return;
}
this.documentstatus = data.status;
if (data.status === 0) {
// The combined document is still waiting for input to be ready.