Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.3.8
ruby 3.3
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
ruby '~> 3.3'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem 'rails', '~> 7.2.3.1'
gem 'rails', '~> 8.1.3'

# Use postgres for all env dbs
gem 'pg'
Expand Down
135 changes: 67 additions & 68 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,79 +1,80 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.2.3.1)
actionpack (= 7.2.3.1)
activesupport (= 7.2.3.1)
action_text-trix (2.1.18)
railties
actioncable (8.1.3)
actionpack (= 8.1.3)
activesupport (= 8.1.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.2.3.1)
actionpack (= 7.2.3.1)
activejob (= 7.2.3.1)
activerecord (= 7.2.3.1)
activestorage (= 7.2.3.1)
activesupport (= 7.2.3.1)
actionmailbox (8.1.3)
actionpack (= 8.1.3)
activejob (= 8.1.3)
activerecord (= 8.1.3)
activestorage (= 8.1.3)
activesupport (= 8.1.3)
mail (>= 2.8.0)
actionmailer (7.2.3.1)
actionpack (= 7.2.3.1)
actionview (= 7.2.3.1)
activejob (= 7.2.3.1)
activesupport (= 7.2.3.1)
actionmailer (8.1.3)
actionpack (= 8.1.3)
actionview (= 8.1.3)
activejob (= 8.1.3)
activesupport (= 8.1.3)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.3.1)
actionview (= 7.2.3.1)
activesupport (= 7.2.3.1)
cgi
actionpack (8.1.3)
actionview (= 8.1.3)
activesupport (= 8.1.3)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.3)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (7.2.3.1)
actionpack (= 7.2.3.1)
activerecord (= 7.2.3.1)
activestorage (= 7.2.3.1)
activesupport (= 7.2.3.1)
actiontext (8.1.3)
action_text-trix (~> 2.1.15)
actionpack (= 8.1.3)
activerecord (= 8.1.3)
activestorage (= 8.1.3)
activesupport (= 8.1.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.2.3.1)
activesupport (= 7.2.3.1)
actionview (8.1.3)
activesupport (= 8.1.3)
builder (~> 3.1)
cgi
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.2.3.1)
activesupport (= 7.2.3.1)
activejob (8.1.3)
activesupport (= 8.1.3)
globalid (>= 0.3.6)
activemodel (7.2.3.1)
activesupport (= 7.2.3.1)
activerecord (7.2.3.1)
activemodel (= 7.2.3.1)
activesupport (= 7.2.3.1)
activemodel (8.1.3)
activesupport (= 8.1.3)
activerecord (8.1.3)
activemodel (= 8.1.3)
activesupport (= 8.1.3)
timeout (>= 0.4.0)
activestorage (7.2.3.1)
actionpack (= 7.2.3.1)
activejob (= 7.2.3.1)
activerecord (= 7.2.3.1)
activesupport (= 7.2.3.1)
activestorage (8.1.3)
actionpack (= 8.1.3)
activejob (= 8.1.3)
activerecord (= 8.1.3)
activesupport (= 8.1.3)
marcel (~> 1.0)
activesupport (7.2.3.1)
activesupport (8.1.3)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1, < 6)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
annotaterb (4.22.0)
Expand All @@ -99,7 +100,6 @@ GEM
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
base64 (0.3.0)
benchmark (0.5.0)
bigdecimal (4.1.0)
bindex (0.8.1)
blazer (3.3.0)
Expand Down Expand Up @@ -127,7 +127,6 @@ GEM
capybara-screenshot (1.0.27)
capybara (>= 1.0, < 4)
launchy
cgi (0.5.1)
chartkick (5.2.1)
childprocess (5.1.0)
logger (~> 1.5)
Expand Down Expand Up @@ -304,7 +303,9 @@ GEM
method_source (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.9)
minitest (5.27.0)
minitest (6.0.3)
drb (~> 2.0)
prism (~> 1.5)
msgpack (1.8.0)
multi_test (1.1.0)
multi_xml (0.8.1)
Expand Down Expand Up @@ -398,20 +399,20 @@ GEM
rack (>= 1.0.0)
rackup (2.3.1)
rack (>= 3)
rails (7.2.3.1)
actioncable (= 7.2.3.1)
actionmailbox (= 7.2.3.1)
actionmailer (= 7.2.3.1)
actionpack (= 7.2.3.1)
actiontext (= 7.2.3.1)
actionview (= 7.2.3.1)
activejob (= 7.2.3.1)
activemodel (= 7.2.3.1)
activerecord (= 7.2.3.1)
activestorage (= 7.2.3.1)
activesupport (= 7.2.3.1)
rails (8.1.3)
actioncable (= 8.1.3)
actionmailbox (= 8.1.3)
actionmailer (= 8.1.3)
actionpack (= 8.1.3)
actiontext (= 8.1.3)
actionview (= 8.1.3)
activejob (= 8.1.3)
activemodel (= 8.1.3)
activerecord (= 8.1.3)
activestorage (= 8.1.3)
activesupport (= 8.1.3)
bundler (>= 1.15.0)
railties (= 7.2.3.1)
railties (= 8.1.3)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -423,10 +424,9 @@ GEM
rails-html-sanitizer (1.7.0)
loofah (~> 2.25)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (7.2.3.1)
actionpack (= 7.2.3.1)
activesupport (= 7.2.3.1)
cgi
railties (8.1.3)
actionpack (= 8.1.3)
activesupport (= 8.1.3)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
Expand Down Expand Up @@ -582,11 +582,10 @@ GEM
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
web-console (4.3.0)
actionview (>= 8.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
railties (>= 8.0.0)
webmock (3.26.2)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand Down Expand Up @@ -644,7 +643,7 @@ DEPENDENCIES
pg
puma (>= 6.0)
rack_session_access
rails (~> 7.2.3.1)
rails (~> 8.1.3)
rails-controller-testing (~> 1.0)
rspec-rails
rspec-retry
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/course_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def reset_email_templates
end

def course_settings_params
params.require(:course_settings).permit(
:enable_extensions,
params.expect(
course_settings: [ :enable_extensions,
:auto_approve_days,
:auto_approve_extended_request_days,
:max_auto_approve,
Expand All @@ -72,7 +72,7 @@ def course_settings_params
:email_subject,
:email_template,
:enable_slack_webhook_url,
:slack_webhook_url
:slack_webhook_url ]
)
end

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/form_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def update
private

def form_setting_params
params.require(:form_setting).permit(
:reason_desc, :documentation_desc, :documentation_disp,
params.expect(
form_setting: [ :reason_desc, :documentation_desc, :documentation_disp,
:custom_q1, :custom_q1_desc, :custom_q1_disp,
:custom_q2, :custom_q2_desc, :custom_q2_disp
:custom_q2, :custom_q2_desc, :custom_q2_disp ]
)
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def set_course_role_from_settings
end

def request_params
params.require(:request).permit(:assignment_id, :reason, :documentation, :custom_q1, :custom_q2, :requested_due_date, :user_id)
params.expect(request: [ :assignment_id, :reason, :documentation, :custom_q1, :custom_q2, :requested_due_date, :user_id ])
end

def authenticate_user
Expand Down
10 changes: 10 additions & 0 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class ApplicationMailer < ActionMailer::Base
# TODO: Deprecate the EmailService class and move the render_templates method to this class.
default from: ENV.fetch('DEFAULT_FROM_EMAIL', '[email protected]')
default content_type: 'text/html'
layout 'mailer'

def generic_email(to:, from:, reply_to:, subject:, body:)
mail(to: to, from: from, reply_to: reply_to, subject: subject, body: body)
end
end
7 changes: 5 additions & 2 deletions app/services/email_service.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# frozen_string_literal: true

# A class for sending templated emails, using basic `{{variable}}` substitution.
# TODO: Migrate this 'Service' to the ApplicationMailer class.
# As of Rails 8.1 we needed to introduct a subclass of ActionMailer::Base.
# We should be able to deprecate this class and move the render_templates method to the FlextensionsMailer class.

class EmailService
class << self
# Given a subject_template and body_template (both strings
Expand All @@ -27,13 +31,12 @@ def render_templates(subject_template, body_template, mapping)
def send_email(to:, from:, reply_to:, subject_template:, body_template:, mapping:, deliver_later: false)
rendered = render_templates(subject_template, body_template, mapping)

mail = ActionMailer::Base.mail(
mail = ApplicationMailer.generic_email(
to: to,
from: from,
reply_to: reply_to,
subject: rendered[:subject],
body: rendered[:body].gsub("\n", "<br>\n"),
content_type: 'text/html'
)

deliver_later ? mail.deliver_later : mail.deliver_now
Expand Down
24 changes: 2 additions & 22 deletions bin/brakeman
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'brakeman' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

ARGV.unshift("--ensure-latest")

load Gem.bin_path("brakeman", "brakeman")
6 changes: 6 additions & 0 deletions bin/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require_relative "../config/boot"
require "active_support/continuous_integration"

CI = ActiveSupport::ContinuousIntegration
require_relative "../config/ci.rb"
2 changes: 2 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env ruby
exec "./bin/rails", "server", *ARGV
2 changes: 1 addition & 1 deletion bin/rubocop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "rubygems"
require "bundler/setup"

# explicit rubocop config increases performance slightly while avoiding config confusion.
# Explicit RuboCop config increases performance slightly while avoiding config confusion.
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))

load Gem.bin_path("rubocop", "rubocop")
Loading
Loading