Skip to content

Commit

Permalink
Bump Rails to 7.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Reyko committed Nov 15, 2023
1 parent 4071960 commit ea39512
Show file tree
Hide file tree
Showing 36 changed files with 283 additions and 121 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'rails', '6.1.7.6'
gem 'rails', '7.0.8'
# This needs to be in here for Heroku
ruby '3.0.6'

Expand Down
120 changes: 63 additions & 57 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,71 +19,77 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
actioncable (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
actionmailbox (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
mail (>= 2.7.1)
actionmailer (6.1.7.6)
actionpack (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activesupport (= 6.1.7.6)
net-imap
net-pop
net-smtp
actionmailer (7.0.8)
actionpack (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activesupport (= 7.0.8)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.6)
actionview (= 6.1.7.6)
activesupport (= 6.1.7.6)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.6)
actionpack (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
actiontext (7.0.8)
actionpack (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.6)
activesupport (= 6.1.7.6)
actionview (7.0.8)
activesupport (= 7.0.8)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.6)
activesupport (= 6.1.7.6)
activejob (7.0.8)
activesupport (= 7.0.8)
globalid (>= 0.3.6)
activemodel (6.1.7.6)
activesupport (= 6.1.7.6)
activemodel (7.0.8)
activesupport (= 7.0.8)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (6.1.7.6)
activemodel (= 6.1.7.6)
activesupport (= 6.1.7.6)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activerecord-safer_migrations (3.0.0)
activerecord (>= 5.2)
activestorage (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activesupport (= 6.1.7.6)
activestorage (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activesupport (= 7.0.8)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.6)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
Expand Down Expand Up @@ -322,21 +328,20 @@ GEM
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.6)
actioncable (= 6.1.7.6)
actionmailbox (= 6.1.7.6)
actionmailer (= 6.1.7.6)
actionpack (= 6.1.7.6)
actiontext (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activemodel (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
rails (7.0.8)
actioncable (= 7.0.8)
actionmailbox (= 7.0.8)
actionmailer (= 7.0.8)
actionpack (= 7.0.8)
actiontext (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activemodel (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
bundler (>= 1.15.0)
railties (= 6.1.7.6)
sprockets-rails (>= 2.0.0)
railties (= 7.0.8)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -348,12 +353,13 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.1.0)
rb-fsevent (0.11.2)
Expand Down Expand Up @@ -572,7 +578,7 @@ DEPENDENCIES
pvb-instrumentation!
rack (>= 2.1.4)
rack-canonical-host
rails (= 6.1.7.6)
rails (= 7.0.8)
rails-controller-testing
rake
request_store
Expand Down
2 changes: 1 addition & 1 deletion app/decorators/nomis/contact_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Nomis::ContactDecorator < Draper::Decorator
def full_name_and_dob
[
"#{given_name} #{surname}",
date_of_birth&.to_s(:short_nomis)
date_of_birth&.to_fs(:short_nomis)
].compact.join(' - ')
end

Expand Down
2 changes: 1 addition & 1 deletion app/decorators/rejection_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def email_visitor_banned_explanation(visitor)
if visitor.banned_until?
h.t('visitor_banned_until_html',
name: visitor.anonymized_name.titleize,
banned_until: visitor.banned_until.to_s(:short_nomis),
banned_until: visitor.banned_until.to_fs(:short_nomis),
scope: %i[visitor_mailer rejected])
else
h.t('visitor_banned_html',
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/date_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module DateHelper
def format_date(datetime)
datetime.to_date.to_s(:short_abbrev)
datetime.to_date.to_fs(:short_abbrev)
end

def format_date_of_birth(datetime)
Expand Down Expand Up @@ -45,15 +45,15 @@ def format_slot_for_public(slot)
def format_slot_for_staff(slot)
I18n.t(
'formats.slot.staff',
date: slot.begin_at.to_date.to_s(:full_nomis),
date: slot.begin_at.to_date.to_fs(:full_nomis),
begin: format_time_24hr(slot.begin_at),
end: format_time_24hr(slot.end_at)
)
end

def format_visit_slot_date_for_staff(visit)
slot = visit.slot_granted || visit.slots.first
slot.to_date.to_s(:short_nomis)
slot.to_date.to_fs(:short_nomis)
end

def format_visit_slot_times_for_staff(visit)
Expand Down
2 changes: 1 addition & 1 deletion app/services/estate_visit_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def visits_to_print_by_slot(date)

visits = Visit.includes(:prisoner, :visitors, :prison)
.processed.from_estates(@estates)
.where('slot_granted LIKE ?', "#{date.to_s(:db)}%")
.where('slot_granted LIKE ?', "#{date.to_fs(:db)}%")
.order('slot_granted asc').to_a

grouped_visits(visits)
Expand Down
9 changes: 6 additions & 3 deletions app/services/nomis/oauth/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
module Nomis
module Oauth
class Client
class_attribute :nomis_oauth_client_id, :nomis_oauth_client_secret

self.nomis_oauth_client_id = Rails.configuration.nomis_oauth_client_id
self.nomis_oauth_client_secret = Rails.configuration.nomis_oauth_client_secret

def initialize(host)
@host = host
@connection = Faraday.new
Expand Down Expand Up @@ -34,9 +39,7 @@ def authorisation
end

def credentials
Base64.strict_encode64(
"#{Rails.configuration.nomis_oauth_client_id}:#{Rails.configuration.nomis_oauth_client_secret}"
)
Base64.strict_encode64("#{nomis_oauth_client_id}:#{nomis_oauth_client_secret}")
end
end
end
Expand Down
6 changes: 4 additions & 2 deletions app/services/nomis/oauth/jwks_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ module Oauth
class JwksService
include Singleton

HOST = Rails.configuration.nomis_oauth_host
class_attribute :host

self.host = Rails.configuration.nomis_oauth_host

attr_reader :oauth_client

def initialize(oauth_client: Nomis::Oauth::Client)
@oauth_client = oauth_client.new(HOST)
@oauth_client = oauth_client.new(host)
end

def fetch_keys
Expand Down
6 changes: 4 additions & 2 deletions app/services/nomis/oauth/token_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ module Oauth
class TokenService
include Singleton

class_attribute :host

self.host = Rails.configuration.nomis_oauth_host

class << self
delegate :valid_token, to: :instance
end
Expand All @@ -25,9 +29,7 @@ def token
end

def fetch_token
host = Rails.configuration.nomis_oauth_host
oauth_client = Nomis::Oauth::Client.new(host)

route = '/auth/oauth/token?grant_type=client_credentials'
response = oauth_client.post(route)
Token.from_json(response)
Expand Down
4 changes: 2 additions & 2 deletions app/views/prison/dashboards/_cancellations.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
<tr>
<td aria-label="<%= t('prisoner_number', scope: :shared) %>"><%= visit.prisoner_number %></td>
<td class="long" aria-label="<%= t('prisoner_name', scope: :shared) %>"><%= visit.prisoner_full_name %></td>
<td class="long" aria-label="<%= t('dob', scope: :shared) %>"><%= visit.prisoner_date_of_birth.to_s(:short_nomis) %></td>
<td class="long" aria-label="<%= t('dob', scope: :shared) %>"><%= visit.prisoner_date_of_birth.to_fs(:short_nomis) %></td>
<td aria-label="<%= t('visit_date', scope: :shared) %>"><%= format_visit_slot_date_for_staff(visit) %></td>
<td aria-label="<%= t('time_slot', scope: :shared) %>"><%= format_visit_slot_times_for_staff(visit) %></td>
<td aria-label="<%= t('cancelled', scope: :shared) %>"><%= visit.cancellation.created_at.to_s(:short) %></td>
<td aria-label="<%= t('cancelled', scope: :shared) %>"><%= visit.cancellation.created_at.to_fs(:short) %></td>
<td aria-label="<%= t('prison', scope: :shared) %>"><%= visit.prison_name %></td>
<td aria-label="<%= t('reference_number', scope: :shared) %>"><%= visit.reference_no %></td>
<td aria-label="<%= t('actions', scope: :shared) %>">
Expand Down
4 changes: 2 additions & 2 deletions app/views/prison/dashboards/_inbox_results.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<% @requested_visits.group_by {|v| v.created_at.to_date}.each do |date, booking| %>
<h3 class="bold-medium">
<span class="text-secondary font-small"><%= t('requested_on', scope: :shared) %></span>
<%= date.to_s(:short) %>
<%= date.to_fs(:short) %>
</h3>
<table class="table--hover push-bottom push-top--half tablesorter">
<caption class="visuallyhidden"><%= t('title', scope: [:prison, :dashboards, :inbox]).capitalize %> - <%= t('requested_on', scope: :shared).downcase %><%= date.to_s(:short) %></caption>
<caption class="visuallyhidden"><%= t('title', scope: [:prison, :dashboards, :inbox]).capitalize %> - <%= t('requested_on', scope: :shared).downcase %><%= date.to_fs(:short) %></caption>
<thead>
<tr>
<th scope="col" data-sorter="false"><%= t('prisoner_name', scope: :shared) %></th>
Expand Down
4 changes: 2 additions & 2 deletions app/views/prison/dashboards/_inbox_search_results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<% visits.each do |visit| %>
<tr>
<td class="long" aria-label="<%= t('prisoner_name', scope: :shared) %>"><%= visit.prisoner_full_name %></td>
<td aria-label="<%= t('visit_date', scope: :shared) %>"><%= visit.slots.first.to_date.to_s(:short_nomis) %></td>
<td aria-label="<%= t('visit_date', scope: :shared) %>"><%= visit.slots.first.to_date.to_fs(:short_nomis) %></td>
<td aria-label="<%= t('visitor_name', scope: :shared) %>"><%= visit.principal_visitor.full_name %></td>
<td aria-label="<%= t('requested', scope: :shared) %>"><%= visit.created_at.to_s(:short) %></td>
<td aria-label="<%= t('requested', scope: :shared) %>"><%= visit.created_at.to_fs(:short) %></td>
<td aria-label="<%= t('prison', scope: :shared) %>"><%= visit.prison_name %></td>
<td aria-label="<%= t('actions', scope: :shared) %>">
<%= link_to prison_visit_path(visit), title: t('view', scope: :shared) do %>
Expand Down
6 changes: 3 additions & 3 deletions app/views/prison/dashboards/_print_cancelled_slot.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
<tr>
<td><%= visit.prisoner_full_name %></td>
<td><%= visit.prisoner_number %></td>
<td><%= visit.principal_visitor.full_name %><br>(<%= visit.principal_visitor.date_of_birth.to_s(:short_nomis) %>)</td>
<td><%= visit.principal_visitor.full_name %><br>(<%= visit.principal_visitor.date_of_birth.to_fs(:short_nomis) %>)</td>
<td><%= visit.contact_phone_no %></td>
<td>
<div>
<% visit.visitors[1..-1].each do |visitor| %>
<%= visitor.full_name %> (<%= visitor.date_of_birth.to_s(:short_nomis) %>)<br>
<%= visitor.full_name %> (<%= visitor.date_of_birth.to_fs(:short_nomis) %>)<br>
<% end %>
</div>
</td>
<td><%= visit.prison_name %></td>
<td><%= visit.updated_at.to_s(:short) %></td>
<td><%= visit.updated_at.to_fs(:short) %></td>
</tr>
<% end %>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion app/views/prison/dashboards/_print_slot.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tr>
<td aria-label="<%= t('prisoner_name', scope: :shared) %>"><%= visit.prisoner_full_name %></td>
<td aria-label="<%= t('prisoner_number', scope: :shared) %>"><%= visit.prisoner_number %></td>
<td aria-label="<%= t('lead_visitor', scope: :shared) %>"><%= visit.principal_visitor.full_name %><br>(<%= visit.principal_visitor.date_of_birth.to_s(:short_nomis) %>)</td>
<td aria-label="<%= t('lead_visitor', scope: :shared) %>"><%= visit.principal_visitor.full_name %><br>(<%= visit.principal_visitor.date_of_birth.to_fs(:short_nomis) %>)</td>
<td aria-label="<%= t('tel', scope: :shared) %>"><%= visit.contact_phone_no %></td>
<td aria-label="<%= t('additional_visitors', scope: :shared) %>">
<div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/prison/dashboards/_request_summary_row.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<tr>
<td class="long" aria-label="<%= t('prisoner_name', scope: :shared) %>"><%= visit.prisoner_full_name %></td>
<td aria-label="<%= t('visit_date', scope: :shared) %>" sorttable_customkey="<%= visit.slots.first %>"><%= visit.slots.first.to_date.to_s(:short_nomis) %></td>
<td aria-label="<%= t('visit_date', scope: :shared) %>" sorttable_customkey="<%= visit.slots.first %>"><%= visit.slots.first.to_date.to_fs(:short_nomis) %></td>
<td aria-label="<%= t('visitor_name', scope: :shared) %>"><%= visit.principal_visitor.full_name %></td>
<td aria-label="<%= t('requested', scope: :shared) %>"><%= visit.created_at.to_s(:time) %></td>
<td aria-label="<%= t('requested', scope: :shared) %>"><%= visit.created_at.to_fs(:time) %></td>
<td aria-label="<%= t('prison', scope: :shared) %>"><%= visit.prison_name %></td>
<td aria-label="<%= t('actions', scope: :shared) %>">
<%= link_to prison_visit_path(visit), {:title => t('view', scope: :shared)} do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/prison/print_visits/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<% end -%>
<% if !@submitted_date.nil? && !@data.any? %>
<p class="lede"><%= t('.no_visits', date: @submitted_date.to_s(:short_nomis)) %></p>
<p class="lede"><%= t('.no_visits', date: @submitted_date.to_fs(:short_nomis)) %></p>
<% end -%>
<% if @submitted_date.nil? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/prison/visits/_prisoner_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<div class="column-one-quarter">
<span class="text-secondary"><%= t('.prisoner_dob') %></span>
<div class="bold-small"><%= @visit.prisoner_date_of_birth.to_s(:short_nomis) %></div>
<div class="bold-small"><%= @visit.prisoner_date_of_birth.to_fs(:short_nomis) %></div>
<% case @visit.prisoner_existance_status %>
<% when PrisonerDetailsPresenter::VALID, PrisonerLocationValidation::INVALID %>
<div class="tag tag--booked font-xsmall"><%= t('.verified') %></div>
Expand Down
Loading

0 comments on commit ea39512

Please sign in to comment.