From 7122c2149a3a94822ea4735f470020bc8c8a63ab Mon Sep 17 00:00:00 2001 From: Tim Schroeder <t.schroeder@itc.rwth-aachen.de> Date: Tue, 6 Sep 2022 13:32:15 +0200 Subject: [PATCH] fixed error after file limit surpassed error --- shared/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/shared/index.js b/shared/index.js index a4b485c..032bd99 100644 --- a/shared/index.js +++ b/shared/index.js @@ -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) { -- GitLab