Skip to content
Snippets Groups Projects
Commit 95be1b58 authored by Tim Schroeder's avatar Tim Schroeder
Browse files

Merge branch 'fix-error-after-file-limit-surpassed-error' into 'testing'

fixed error after file limit surpassed error

See merge request moodle_l2p/moodle-mod_pdfannotator!175
parents 1af43c20 7122c214
No related branches found
No related tags found
No related merge requests found
......@@ -282,16 +282,19 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
return data;
}else if (data.status == -1){
notification.alert(M.util.get_string('error','pdfannotator'),M.util.get_string('missingAnnotation','pdfannotator'),'ok');
return false;
} else if (data.status === "error" && data.type === "maxfile") {
notification.addNotification({
message: M.util.get_string('error:maximalfilenumber_created','pdfannotator', data.maxFileCount),
type: "error"
});
return false;
} else {
notification.addNotification({
message: M.util.get_string('error:addComment','pdfannotator'),
type: "error"
});
return false;
}
});
},
......@@ -1576,6 +1579,9 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
* @return {Element}
*/
function insertComments(comments, markCommentid = undefined) {
if(!comments) {
return false;
}
if(!comments.comments){
comments = {comments: [comments]};
}
......@@ -1631,7 +1637,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
}); // add a catch
}
})(templates, comments);
return true;
}
function createSolvedHandler(comment){
......@@ -2015,7 +2021,10 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
}
_2.default.getStoreAdapter().addComment(documentId, annotationId, commentContentElements.innerHTML, commentVisibility, isquestion)
.then(insertComments)
.then(function () {
.then(function (success) {
if (!success) {
return false;
}
document.querySelector('#commentSubmit').disabled = false;
commentText.value = '';
if(editorArea) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment