Skip to content

Commit

Permalink
MDL-75898 assignfeedback_editpdf: Don't poll readonly pages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cameron1729 authored and matthewhilton committed May 11, 2023
1 parent 825609a commit 9035091
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 5 deletions.
Expand Up @@ -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.
Expand Down

0 comments on commit 9035091

Please sign in to comment.