Index: lams_build/conf/etherpad/etherpad-lite/node_modules/ep_comments_page/static/js/index.js =================================================================== diff -u -rf9dafe60150e1899c37200977b198e0546ced60c -r7ba9b61ebdd7931c2db2078f365b10f2b9c776ad --- lams_build/conf/etherpad/etherpad-lite/node_modules/ep_comments_page/static/js/index.js (.../index.js) (revision f9dafe60150e1899c37200977b198e0546ced60c) +++ lams_build/conf/etherpad/etherpad-lite/node_modules/ep_comments_page/static/js/index.js (.../index.js) (revision 7ba9b61ebdd7931c2db2078f365b10f2b9c776ad) @@ -344,6 +344,7 @@ // LAMS modifies this logic so right comments bar is hidden by default $('#options-comments').prop('checked', padcookie.getPref('comments') === true); + $('#options-comments').on('change', () => { const checked = $('#options-comments').is(':checked'); padcookie.setPref('comments', checked); @@ -883,9 +884,12 @@ rep.lines = saveRep.lines; rep.selStart = saveRep.selStart; rep.selEnd = saveRep.selEnd; + rep.hasCommentsOnSelection = ace.ace_hasCommentOnSelection(); }, 'saveCommentedSelection', true); + const selectedText = this.getSelectedText(rep); + // we have nothing selected, do nothing const noTextSelected = (selectedText.length === 0); if (noTextSelected) { @@ -896,6 +900,14 @@ return; } + //LAMS modification: prevent comments from being overwritten + if (rep.hasCommentsOnSelection) { + $.gritter.add({ + text: 'This text already has a comment. Reply on the existing comment instead.' + }); + return; + } + this.createNewCommentFormIfDontExist(rep); // Write the text to the changeFrom form