diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 60c05971..367d9f1d 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -81,7 +81,6 @@ class CommentsController < ApplicationController comment_params.except :request_id end - # Never trust parameters from the scary internet, only allow the white list through. def comment_params # params.require(:comment).permit(:user_id, :file_id, :row, :column, :text) # fuer production mode, damit böse menschen keine falsche user_id uebergeben: diff --git a/app/controllers/error_template_attributes_controller.rb b/app/controllers/error_template_attributes_controller.rb index 425c69d4..2a89d00c 100644 --- a/app/controllers/error_template_attributes_controller.rb +++ b/app/controllers/error_template_attributes_controller.rb @@ -89,7 +89,6 @@ class ErrorTemplateAttributesController < ApplicationController @error_template_attribute = ErrorTemplateAttribute.find(params[:id]) end - # Never trust parameters from the scary internet, only allow the white list through. def error_template_attribute_params if params[:error_template_attribute].present? params[:error_template_attribute].permit(:key, :description, :regex, diff --git a/app/controllers/error_templates_controller.rb b/app/controllers/error_templates_controller.rb index 654f97a7..a246c312 100644 --- a/app/controllers/error_templates_controller.rb +++ b/app/controllers/error_templates_controller.rb @@ -100,7 +100,6 @@ class ErrorTemplatesController < ApplicationController @error_template = ErrorTemplate.find(params[:id]) end - # Never trust parameters from the scary internet, only allow the white list through. def error_template_params if params[:error_template].present? params[:error_template].permit(:name, :execution_environment_id, :signature, :description, diff --git a/app/controllers/file_templates_controller.rb b/app/controllers/file_templates_controller.rb index da1ae5b1..43e9596b 100644 --- a/app/controllers/file_templates_controller.rb +++ b/app/controllers/file_templates_controller.rb @@ -90,7 +90,6 @@ class FileTemplatesController < ApplicationController @file_template = FileTemplate.find(params[:id]) end - # Never trust parameters from the scary internet, only allow the white list through. def file_template_params params[:file_template].permit(:name, :file_type_id, :content) if params[:file_template].present? end diff --git a/app/controllers/request_for_comments_controller.rb b/app/controllers/request_for_comments_controller.rb index 4bc18df1..f3959af4 100644 --- a/app/controllers/request_for_comments_controller.rb +++ b/app/controllers/request_for_comments_controller.rb @@ -141,7 +141,6 @@ class RequestForCommentsController < ApplicationController @request_for_comment = RequestForComment.find(params[:id]) end - # Never trust parameters from the scary internet, only allow the white list through. def request_for_comment_params # The study_group_id might not be present in the session (e.g. for internal users), resulting in session[:study_group_id] = nil which is intended. params.require(:request_for_comment).permit(:exercise_id, :file_id, :question, :requested_at, :solved, :submission_id).merge( diff --git a/app/helpers/statistics_helper.rb b/app/helpers/statistics_helper.rb index 57ddd57d..a9e669b7 100644 --- a/app/helpers/statistics_helper.rb +++ b/app/helpers/statistics_helper.rb @@ -165,9 +165,9 @@ module StatisticsHelper key: 'rfcs_with_comments', name: t('statistics.entries.request_for_comments.with_comments'), data: RequestForComment.in_range(from, - to).joins('join "submissions" s on s.id = request_for_comments.submission_id - join "files" f on f.context_id = s.id and f.context_type = \'Submission\' - join "comments" c on c.file_id = f.id').group('request_for_comments.id').count.size, + to).joins('join "submissions" s on s.id = request_for_comments.submission_id ' \ + 'join "files" f on f.context_id = s.id and f.context_type = \'Submission\' ' \ + 'join "comments" c on c.file_id = f.id').group('request_for_comments.id').count.size, url: statistics_graphs_path, }, ] diff --git a/app/models/request_for_comment.rb b/app/models/request_for_comment.rb index e671492e..d32bb894 100644 --- a/app/models/request_for_comment.rb +++ b/app/models/request_for_comment.rb @@ -81,9 +81,9 @@ class RequestForComment < ApplicationRecord class << self def with_last_activity - 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" c on c.file_id = f.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" c on c.file_id = f.id') .group('request_for_comments.id') .select('request_for_comments.*, max(c.updated_at) as last_comment') end @@ -91,10 +91,10 @@ class RequestForComment < ApplicationRecord def last_per_user(count = 5) from("(#{row_number_user_sql}) as request_for_comments") .where('row_number <= ?', count) - .group('request_for_comments.id, request_for_comments.user_id, request_for_comments.user_type, - 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.solved, - request_for_comments.full_score_reached, request_for_comments.submission_id, request_for_comments.row_number') + .group('request_for_comments.id, request_for_comments.user_id, request_for_comments.user_type, ' \ + '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.solved, ' \ + 'request_for_comments.full_score_reached, request_for_comments.submission_id, request_for_comments.row_number') # ugly, but necessary end diff --git a/config/environments/development.rb b/config/environments/development.rb index 3a554602..a49ea5a8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -5,7 +5,7 @@ require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.web_console.whitelisted_ips = '192.168.0.0/16' + config.web_console.allowed_ips = '192.168.0.0/16' # In the development environment your application's code is reloaded any time # it changes. This slows down response time but is perfect for development diff --git a/config/environments/production.rb b/config/environments/production.rb index 39abff0a..cfb69a12 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -19,9 +19,11 @@ Rails.application.configure do config.consider_all_requests_local = false config.action_controller.perform_caching = true + # rubocop:disable Naming/InclusiveLanguage # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true + # rubocop:enable Naming/InclusiveLanguage # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this.