From 38c6e29cbf5ef2a307e63ffef614fc5f6356ce01 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Wed, 19 Jul 2017 14:29:45 +0200 Subject: [PATCH 01/24] remove webWorker outputs from request_for_comments --- app/views/request_for_comments/show.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/request_for_comments/show.html.erb b/app/views/request_for_comments/show.html.erb index b28c1eb9..05e2249f 100644 --- a/app/views/request_for_comments/show.html.erb +++ b/app/views/request_for_comments/show.html.erb @@ -134,6 +134,7 @@ also, all settings from the rails model needed for the editor configuration in t currentEditor.setReadOnly(true); // set editor mode (used for syntax highlighting currentEditor.getSession().setMode($(editor).data('mode')); + currentEditor.getSession().setOption("useWorker", false); setAnnotations(currentEditor, $(editor).data('file-id')); currentEditor.on("guttermousedown", handleSidebarClick); From f877cd675a8020c802470e3f85af061ef064e3e1 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Fri, 4 Aug 2017 16:39:23 +0200 Subject: [PATCH 02/24] move user-id for codeocean-events into in_context --- app/assets/javascripts/editor/editor.js.erb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index e3e34462..2d145e34 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -155,9 +155,9 @@ configureEditors: function () { if (!same) { this.publishCodeOceanEvent("codeocean_editor_paste", { text: pasteObject.text, + codeocean_user_id: $('#editor').data('user-id'), exercise: $('#editor').data('exercise-id'), file_id: "1" - }); } }, @@ -390,9 +390,7 @@ configureEditors: function () { var payload = { user: { - type: 'User', - uuid: $('#editor').data('user-id'), - external_id: $('#editor').data('user-external-id') + uuid: $('#editor').data('user-external-id') }, verb: { type: eventName From 9592b5c939dfe160503753952d10789f3a2a8a17 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Fri, 11 Aug 2017 18:23:16 +0200 Subject: [PATCH 03/24] removed tabs from rfc comment overlays fixed minor typo in thank you emails --- app/views/request_for_comments/show.html.erb | 2 +- config/locales/de.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/request_for_comments/show.html.erb b/app/views/request_for_comments/show.html.erb index 05e2249f..6a21ca24 100644 --- a/app/views/request_for_comments/show.html.erb +++ b/app/views/request_for_comments/show.html.erb @@ -160,7 +160,7 @@ also, all settings from the rails model needed for the editor configuration in t if(comment.text.includes("\n") || comment.text.includes("\t")){ comment.text = comment.username + ": " + comment.text; } else { - comment.text = comment.username + ": " + stringDivider(comment.text, 80, "\n\t\t"); + comment.text = comment.username + ": " + stringDivider(comment.text, 80, "\n"); } }); diff --git a/config/locales/de.yml b/config/locales/de.yml index d0aef588..021f65a7 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -444,7 +444,7 @@ de: Thank you for helping other users on CodeOcean!
This mail was automatically sent by CodeOcean.
- subject: "%{author} sagt danke!" + subject: "%{author} sagt Danke!" request_for_comments: click_here: Zum Kommentieren auf die Seitenleiste klicken! comments: Kommentare From b2344cfd97b9a929500f03ba28c69379b1e372de Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Sun, 13 Aug 2017 14:33:12 +0200 Subject: [PATCH 04/24] Add last activity label to RFCs --- app/views/request_for_comments/index.html.slim | 3 +++ config/locales/de.yml | 1 + config/locales/en.yml | 1 + 3 files changed, 5 insertions(+) diff --git a/app/views/request_for_comments/index.html.slim b/app/views/request_for_comments/index.html.slim index db16b562..51b3a01b 100644 --- a/app/views/request_for_comments/index.html.slim +++ b/app/views/request_for_comments/index.html.slim @@ -20,6 +20,7 @@ h1 = RequestForComment.model_name.human(count: 2) i class="fa fa-comment" aria-hidden="true" title = t('request_for_comments.comments') align="center" th = t('activerecord.attributes.request_for_comments.username') th = t('activerecord.attributes.request_for_comments.requested_at') + th = t('activerecord.attributes.request_for_comments.last_update') tbody - @request_for_comments.each do |request_for_comment| tr data-id=request_for_comment.id @@ -36,5 +37,7 @@ h1 = RequestForComment.model_name.human(count: 2) td = request_for_comment.comments_count td = request_for_comment.user.displayname td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.created_at)) + - last_comment = request_for_comment.comments.order('created_at DESC').first + td = t('shared.time.before', time: distance_of_time_in_words_to_now(last_comment.nil? ? request_for_comment.updated_at : last_comment.updated_at)) = render('shared/pagination', collection: @request_for_comments) \ No newline at end of file diff --git a/config/locales/de.yml b/config/locales/de.yml index d0aef588..3e780d8f 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -94,6 +94,7 @@ de: requested_at: Angefragezeitpunkt question: "Frage" close: "Fenster schließen" + last_update: "Letzte Aktivität" submission: cause: Anlass code: Code diff --git a/config/locales/en.yml b/config/locales/en.yml index 9a334697..47e97c9d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -115,6 +115,7 @@ en: requested_at: Request Date question: "Question" close: Close window + last_update: "Last Update" submission: cause: Cause code: Code From 726ef31ee7f2e8265b2728309e04066b228a6ae3 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Sun, 13 Aug 2017 15:01:11 +0200 Subject: [PATCH 05/24] Add new route to view all RFCs the user has commented on --- app/controllers/request_for_comments_controller.rb | 14 ++++++++++++++ app/views/request_for_comments/index.html.slim | 4 ++-- config/locales/de.yml | 1 + config/locales/en.yml | 1 + config/routes.rb | 1 + 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/controllers/request_for_comments_controller.rb b/app/controllers/request_for_comments_controller.rb index eb2305cc..020f1ba1 100644 --- a/app/controllers/request_for_comments_controller.rb +++ b/app/controllers/request_for_comments_controller.rb @@ -22,6 +22,20 @@ class RequestForCommentsController < ApplicationController render 'index' end + def get_rfcs_with_my_comments + @search = RequestForComment + .joins(:comments) + .where(comments: {user_id: current_user.id}) + .group('request_for_comments.id') + .joins(:comments) + .group('request_for_comments.id') + .select('request_for_comments.*, max(comments.updated_at) as last_comment') + .order('last_comment DESC') + .search(params[:q]) + @request_for_comments = @search.result.paginate(page: params[:page]) + render 'index' + end + def mark_as_solved authorize! @request_for_comment.solved = true diff --git a/app/views/request_for_comments/index.html.slim b/app/views/request_for_comments/index.html.slim index 51b3a01b..34316dd0 100644 --- a/app/views/request_for_comments/index.html.slim +++ b/app/views/request_for_comments/index.html.slim @@ -37,7 +37,7 @@ h1 = RequestForComment.model_name.human(count: 2) td = request_for_comment.comments_count td = request_for_comment.user.displayname td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.created_at)) - - last_comment = request_for_comment.comments.order('created_at DESC').first - td = t('shared.time.before', time: distance_of_time_in_words_to_now(last_comment.nil? ? request_for_comment.updated_at : last_comment.updated_at)) + //- last_comment = request_for_comment.last_comment || request_for_comment.comments.order('created_at DESC').try(:first).try(:updated_at) + td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.last_comment)) = render('shared/pagination', collection: @request_for_comments) \ No newline at end of file diff --git a/config/locales/de.yml b/config/locales/de.yml index 3e780d8f..18f2e667 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -457,6 +457,7 @@ de: index: get_my_comment_requests: Meine Kommentaranfragen all: "Alle Kommentaranfragen" + get_rfcs_with_my_comments: Kommentaranfragen die ich kommentiert habe no_question: "Der Autor hat keine Frage zu dieser Anfrage gestellt." mark_as_solved: "Diese Frage als beantwortet markieren" show_all: "Alle Anfragen anzeigen" diff --git a/config/locales/en.yml b/config/locales/en.yml index 47e97c9d..8db86035 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -478,6 +478,7 @@ en: index: all: All Requests for Comments get_my_comment_requests: My Requests for Comments + get_rfcs_with_my_comments: Requests for Comments I have commented on no_question: "The author did not enter a question for this request." mark_as_solved: "Mark this question as answered" show_all: "All requests" diff --git a/config/routes.rb b/config/routes.rb index d340a204..65a8f56a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,6 +20,7 @@ Rails.application.routes.draw do end end get '/my_request_for_comments', as: 'my_request_for_comments', to: 'request_for_comments#get_my_comment_requests' + get '/my_rfc_activity', as: 'my_rfc_activity', to: 'request_for_comments#get_rfcs_with_my_comments' delete '/comment_by_id', to: 'comments#destroy_by_id' put '/comments', to: 'comments#update' From ba8511fe4052622e9b5c5903af53edbab8c0e217 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Sun, 13 Aug 2017 16:09:15 +0200 Subject: [PATCH 06/24] Fall back on RFC update time when there are no comments --- app/views/request_for_comments/index.html.slim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/request_for_comments/index.html.slim b/app/views/request_for_comments/index.html.slim index 34316dd0..a081dd55 100644 --- a/app/views/request_for_comments/index.html.slim +++ b/app/views/request_for_comments/index.html.slim @@ -37,7 +37,6 @@ h1 = RequestForComment.model_name.human(count: 2) td = request_for_comment.comments_count td = request_for_comment.user.displayname td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.created_at)) - //- last_comment = request_for_comment.last_comment || request_for_comment.comments.order('created_at DESC').try(:first).try(:updated_at) - td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.last_comment)) + td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.last_comment.nil? ? request_for_comment.updated_at : request_for_comment.last_comment)) = render('shared/pagination', collection: @request_for_comments) \ No newline at end of file From 06f11ae6f5dca13457bbb37042af65f931d69476 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Sun, 13 Aug 2017 16:09:44 +0200 Subject: [PATCH 07/24] Fix RFC lists for RFCs without comments --- .../request_for_comments_controller.rb | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/app/controllers/request_for_comments_controller.rb b/app/controllers/request_for_comments_controller.rb index 020f1ba1..327d7aa7 100644 --- a/app/controllers/request_for_comments_controller.rb +++ b/app/controllers/request_for_comments_controller.rb @@ -11,28 +11,44 @@ class RequestForCommentsController < ApplicationController # GET /request_for_comments # GET /request_for_comments.json def index - @search = RequestForComment.last_per_user(2).search(params[:q]) + @search = RequestForComment + .last_per_user(2) + .joins('join "submissions" s on s.id = request_for_comments.submission_id + left outer join "files" f on f.context_id = s.id + left outer join "comments" on comments.file_id = f.id') + .group('request_for_comments.id, request_for_comments.user_id, request_for_comments.exercise_id, + request_for_comments.file_id, request_for_comments.question, request_for_comments.created_at, + request_for_comments.updated_at, request_for_comments.user_type, request_for_comments.solved, + request_for_comments.submission_id, request_for_comments.row_number') # ugly, but rails wants it this way + .select('request_for_comments.*, max(comments.updated_at) as last_comment') + .search(params[:q]) @request_for_comments = @search.result.order('created_at DESC').paginate(page: params[:page]) authorize! end def get_my_comment_requests - @search = RequestForComment.where(user_id: current_user.id).order('created_at DESC').search(params[:q]) - @request_for_comments = @search.result.paginate(page: params[:page]) + @search = RequestForComment + .where(user_id: current_user.id) + .joins('join "submissions" s on s.id = request_for_comments.submission_id + left outer join "files" f on f.context_id = s.id + left outer join "comments" on comments.file_id = f.id') + .group('request_for_comments.id') + .select('request_for_comments.*, max(comments.updated_at) as last_comment') + .search(params[:q]) + @request_for_comments = @search.result.order('created_at DESC').paginate(page: params[:page]) render 'index' end def get_rfcs_with_my_comments @search = RequestForComment - .joins(:comments) + .joins(:comments) # we don't need to outer join here, because we know the user has commented on these .where(comments: {user_id: current_user.id}) .group('request_for_comments.id') .joins(:comments) .group('request_for_comments.id') .select('request_for_comments.*, max(comments.updated_at) as last_comment') - .order('last_comment DESC') .search(params[:q]) - @request_for_comments = @search.result.paginate(page: params[:page]) + @request_for_comments = @search.result.order('last_comment DESC').paginate(page: params[:page]) render 'index' end From 5de32edcc9a72ac332f079c79fc6fc2a9c773d1b Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Sun, 13 Aug 2017 16:13:40 +0200 Subject: [PATCH 08/24] Add link to comment activity to session menu --- app/views/application/_session.html.slim | 1 + config/locales/de.yml | 1 + config/locales/en.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/app/views/application/_session.html.slim b/app/views/application/_session.html.slim index cbbf3b12..eb9f4d23 100644 --- a/app/views/application/_session.html.slim +++ b/app/views/application/_session.html.slim @@ -10,6 +10,7 @@ li = link_to(t('internal_users.show.link'), current_user) li = link_to(t('request_for_comments.index.all'), request_for_comments_path) li = link_to(t('request_for_comments.index.get_my_comment_requests'), my_request_for_comments_path) + li = link_to(t('request_for_comments.index.get_my_rfc_activity'), my_rfc_activity_path) - if current_user.internal_user? li = link_to(t('sessions.destroy.link'), sign_out_path, method: :delete) - else diff --git a/config/locales/de.yml b/config/locales/de.yml index 18f2e667..59cd816c 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -458,6 +458,7 @@ de: get_my_comment_requests: Meine Kommentaranfragen all: "Alle Kommentaranfragen" get_rfcs_with_my_comments: Kommentaranfragen die ich kommentiert habe + get_my_rfc_activity: "Meine Kommentaraktivität" no_question: "Der Autor hat keine Frage zu dieser Anfrage gestellt." mark_as_solved: "Diese Frage als beantwortet markieren" show_all: "Alle Anfragen anzeigen" diff --git a/config/locales/en.yml b/config/locales/en.yml index 8db86035..e20a0191 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -479,6 +479,7 @@ en: all: All Requests for Comments get_my_comment_requests: My Requests for Comments get_rfcs_with_my_comments: Requests for Comments I have commented on + get_my_rfc_activity: "My Comment Activity" no_question: "The author did not enter a question for this request." mark_as_solved: "Mark this question as answered" show_all: "All requests" From 653aefa2c73f76d8a8178ea72710aac583ac122b Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Sun, 13 Aug 2017 16:24:03 +0200 Subject: [PATCH 09/24] Update "last saved at" label after all types of submissions, not only autosaves --- app/assets/javascripts/editor/submissions.js.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/editor/submissions.js.erb b/app/assets/javascripts/editor/submissions.js.erb index 467c2cd7..20d8cd10 100644 --- a/app/assets/javascripts/editor/submissions.js.erb +++ b/app/assets/javascripts/editor/submissions.js.erb @@ -75,6 +75,8 @@ CodeOceanEditorSubmissions = { } // toggle button states (it might be the case that the request for comments button has to be enabled this.toggleButtonStates(); + + this.updateSaveStateLabel(); }, /** @@ -200,12 +202,15 @@ CodeOceanEditorSubmissions = { } }, - autosave: function () { + updateSaveStateLabel: function() { var date = new Date(); var autosaveLabel = $(this.autosaveLabel); autosaveLabel.parent().css("visibility", "visible"); autosaveLabel.text(date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds()); autosaveLabel.text(date.toLocaleTimeString()); + }, + + autosave: function () { this.autosaveTimer = null; this.createSubmission($('#autosave'), null); } From 520a60d1bef5087a7a1315fb6718be9556b4bcd0 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Sun, 13 Aug 2017 18:46:35 +0200 Subject: [PATCH 10/24] Use popovers with formatted comments instead of tooltips --- app/views/request_for_comments/show.html.erb | 27 +++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/app/views/request_for_comments/show.html.erb b/app/views/request_for_comments/show.html.erb index 6a21ca24..ce6f8d8e 100644 --- a/app/views/request_for_comments/show.html.erb +++ b/app/views/request_for_comments/show.html.erb @@ -153,18 +153,37 @@ also, all settings from the rails model needed for the editor configuration in t }); jqrequest.done(function(response){ - $.each(response, function(index, comment) { - comment.className = "code-ocean_comment"; + var comments = response.slice().sort(function (a, b) { + return a.row > b.row; + }); + while (comments.length > 0) { + var cluster = []; + var clusterRow = comments[0].row; + while (comments.length > 0 && comments[0].row === clusterRow) { + cluster.push(comments.shift()); + } + var popupContent = ''; + cluster.forEach(function(comment) { + popupContent += '

' + comment.username + ': ' + comment.text.replace(/\n/g, '
') + '

'; + }); + var icon = $('*[data-file-id="' + fileid + '"] > .ace_gutter > .ace_gutter-layer > .ace_gutter-cell:contains("' + (clusterRow + 1) + '")'); + icon.popover({ + content: popupContent, + html: true, + trigger: 'hover', + container: 'body' + }); + } + $.each(response, function(index, comment) { + comment.className = 'code-ocean_comment'; // if we have tabs or carriage returns in the comment, just add the name and leave it as it is. otherwise: format! if(comment.text.includes("\n") || comment.text.includes("\t")){ comment.text = comment.username + ": " + comment.text; } else { comment.text = comment.username + ": " + stringDivider(comment.text, 80, "\n"); } - }); - session.setAnnotations(response); }) } From e1c45f025fd294519569fea5b9b33a33d671790a Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Sun, 13 Aug 2017 18:46:55 +0200 Subject: [PATCH 11/24] Hide Ace's tooltips for annotations --- app/assets/stylesheets/request-for-comments.css.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/request-for-comments.css.scss b/app/assets/stylesheets/request-for-comments.css.scss index cbaf9d36..87eeba44 100644 --- a/app/assets/stylesheets/request-for-comments.css.scss +++ b/app/assets/stylesheets/request-for-comments.css.scss @@ -17,3 +17,7 @@ width: 100%; height: 200px; } + +.ace_tooltip { + display: none !important; +} From 9e53fb4ea57a3c6f51e8f600ea75b412add26b2c Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 16 Aug 2017 16:03:49 +0200 Subject: [PATCH 12/24] Fix query for RFC activity --- app/controllers/request_for_comments_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/request_for_comments_controller.rb b/app/controllers/request_for_comments_controller.rb index 327d7aa7..fca5c99b 100644 --- a/app/controllers/request_for_comments_controller.rb +++ b/app/controllers/request_for_comments_controller.rb @@ -43,10 +43,11 @@ class RequestForCommentsController < ApplicationController @search = RequestForComment .joins(:comments) # we don't need to outer join here, because we know the user has commented on these .where(comments: {user_id: current_user.id}) + .joins('join "submissions" s on s.id = request_for_comments.submission_id + left outer join "files" f on f.context_id = s.id + left outer join "comments" as c on c.file_id = f.id') .group('request_for_comments.id') - .joins(:comments) - .group('request_for_comments.id') - .select('request_for_comments.*, max(comments.updated_at) as last_comment') + .select('request_for_comments.*, max(c.updated_at) as last_comment') .search(params[:q]) @request_for_comments = @search.result.order('last_comment DESC').paginate(page: params[:page]) render 'index' From 0f3db8a644fae7ee39f952dcb10726f5ffd5e454 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 16 Aug 2017 17:29:08 +0200 Subject: [PATCH 13/24] Remove old comments before refresh to fix event leak --- app/views/request_for_comments/show.html.erb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/request_for_comments/show.html.erb b/app/views/request_for_comments/show.html.erb index ce6f8d8e..3e889ac6 100644 --- a/app/views/request_for_comments/show.html.erb +++ b/app/views/request_for_comments/show.html.erb @@ -140,6 +140,11 @@ also, all settings from the rails model needed for the editor configuration in t currentEditor.on("guttermousedown", handleSidebarClick); }); + function cleanupPopovers() { + // remove all possible popovers + $('.editor > .ace_gutter > .ace_gutter-layer > .ace_gutter-cell').popover('destroy'); + } + function setAnnotations(editor, fileid) { var session = editor.getSession(); @@ -166,7 +171,7 @@ also, all settings from the rails model needed for the editor configuration in t cluster.forEach(function(comment) { popupContent += '

' + comment.username + ': ' + comment.text.replace(/\n/g, '
') + '

'; }); - var icon = $('*[data-file-id="' + fileid + '"] > .ace_gutter > .ace_gutter-layer > .ace_gutter-cell:contains("' + (clusterRow + 1) + '")'); + var icon = $('*[data-file-id="' + fileid + '"] > .ace_gutter > .ace_gutter-layer > div:nth-child(' + (clusterRow + 1) + ')'); icon.popover({ content: popupContent, html: true, @@ -201,6 +206,7 @@ also, all settings from the rails model needed for the editor configuration in t } function deleteComment(file_id, row, editor) { + cleanupPopovers(); var jqxhr = $.ajax({ type: 'DELETE', url: "/comments", @@ -215,6 +221,7 @@ also, all settings from the rails model needed for the editor configuration in t } function createComment(file_id, row, editor, commenttext){ + cleanupPopovers(); var jqxhr = $.ajax({ data: { comment: { From 1ffda4f89685419dd4750802214d633a1aa61f53 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 16 Aug 2017 17:29:26 +0200 Subject: [PATCH 14/24] Fix cluster sorting --- app/views/request_for_comments/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/request_for_comments/show.html.erb b/app/views/request_for_comments/show.html.erb index 3e889ac6..4907949b 100644 --- a/app/views/request_for_comments/show.html.erb +++ b/app/views/request_for_comments/show.html.erb @@ -159,7 +159,7 @@ also, all settings from the rails model needed for the editor configuration in t jqrequest.done(function(response){ var comments = response.slice().sort(function (a, b) { - return a.row > b.row; + return a.row - b.row; }); while (comments.length > 0) { var cluster = []; From b5c997e8a959eb9623ffff109eadfdbd752cd46a Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 16 Aug 2017 18:20:56 +0200 Subject: [PATCH 15/24] Preprocess comment text to protect from XSS attacks --- app/views/request_for_comments/show.html.erb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/request_for_comments/show.html.erb b/app/views/request_for_comments/show.html.erb index 4907949b..96470d05 100644 --- a/app/views/request_for_comments/show.html.erb +++ b/app/views/request_for_comments/show.html.erb @@ -64,6 +64,8 @@


+ +