Skip to content

Upgrade Rails to 7.1 #2250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
ruby '3.4.4'

gem 'rails', '7.0.8.1'
gem 'rails', '~> 7.1.5.1' # LOCKED: It is Rails.
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'

Expand All @@ -10,7 +10,7 @@ gem 'benchmark' # LOCKED: Added because of activesupport 7.0
gem 'bigdecimal' # LOCKED: Added because of activesupport 7.0
gem 'carrierwave'
gem 'cocoon'
gem "csv" # LOCKED: csv was loaded from the standard library, but is not part of the default gems starting from Ruby 3.4.0. Due to config/application.rb
gem 'csv' # LOCKED: csv was loaded from the standard library, but is not part of the default gems starting from Ruby 3.4.0. Due to config/application.rb
gem 'delayed_job'
gem 'delayed_job_active_record'
gem 'drb' # LOCKED: Added because of pry-remote
Expand Down Expand Up @@ -119,4 +119,4 @@ end
gem 'rollbar'
gem 'skylight'

gem "carrierwave-aws", "~> 1.6"
gem 'carrierwave-aws', '~> 1.6'
168 changes: 95 additions & 73 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,73 +1,85 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
actioncable (7.1.5.1)
actionpack (= 7.1.5.1)
activesupport (= 7.1.5.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.5.1)
actionpack (= 7.1.5.1)
activejob (= 7.1.5.1)
activerecord (= 7.1.5.1)
activestorage (= 7.1.5.1)
activesupport (= 7.1.5.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.1)
actionpack (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionmailer (7.1.5.1)
actionpack (= 7.1.5.1)
actionview (= 7.1.5.1)
activejob (= 7.1.5.1)
activesupport (= 7.1.5.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
rack (~> 2.0, >= 2.2.4)
rails-dom-testing (~> 2.2)
actionpack (7.1.5.1)
actionview (= 7.1.5.1)
activesupport (= 7.1.5.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8.1)
actionpack (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.5.1)
actionpack (= 7.1.5.1)
activerecord (= 7.1.5.1)
activestorage (= 7.1.5.1)
activesupport (= 7.1.5.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
actionview (7.1.5.1)
activesupport (= 7.1.5.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.5.1)
activesupport (= 7.1.5.1)
globalid (>= 0.3.6)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activestorage (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activesupport (= 7.0.8.1)
activemodel (7.1.5.1)
activesupport (= 7.1.5.1)
activerecord (7.1.5.1)
activemodel (= 7.1.5.1)
activesupport (= 7.1.5.1)
timeout (>= 0.4.0)
activestorage (7.1.5.1)
actionpack (= 7.1.5.1)
activejob (= 7.1.5.1)
activerecord (= 7.1.5.1)
activesupport (= 7.1.5.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8.1)
activesupport (7.1.5.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
securerandom (>= 0.3)
tzinfo (~> 2.0)
acts-as-taggable-on (11.0.0)
activerecord (>= 7.0, < 8.0)
acts-as-taggable-on (12.0.0)
activerecord (>= 7.1, < 8.1)
zeitwerk (>= 2.4, < 3.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
Expand Down Expand Up @@ -144,6 +156,7 @@ GEM
commonmarker (2.3.2)
rb_sys (~> 0.9)
concurrent-ruby (1.3.5)
connection_pool (2.5.3)
crass (1.0.6)
css_parser (1.14.0)
addressable
Expand Down Expand Up @@ -261,14 +274,14 @@ GEM
mutex_m (0.3.0)
net-http (0.6.0)
uri
net-imap (0.4.20)
net-imap (0.5.9)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.9)
Expand Down Expand Up @@ -341,28 +354,34 @@ GEM
pundit (2.5.0)
activesupport (>= 3.0.0)
racc (1.8.1)
rack (2.2.17)
rack (3.2.0)
rack-mini-profiler (3.3.1)
rack (>= 1.2.0)
rack-protection (3.2.0)
rack-protection (4.1.1)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.2.0)
rack (>= 1.3)
rails (7.0.8.1)
actioncable (= 7.0.8.1)
actionmailbox (= 7.0.8.1)
actionmailer (= 7.0.8.1)
actionpack (= 7.0.8.1)
actiontext (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activemodel (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
rackup (2.2.1)
rack (>= 3)
rails (7.1.5.1)
actioncable (= 7.1.5.1)
actionmailbox (= 7.1.5.1)
actionmailer (= 7.1.5.1)
actionpack (= 7.1.5.1)
actiontext (= 7.1.5.1)
actionview (= 7.1.5.1)
activejob (= 7.1.5.1)
activemodel (= 7.1.5.1)
activerecord (= 7.1.5.1)
activestorage (= 7.1.5.1)
activesupport (= 7.1.5.1)
bundler (>= 1.15.0)
railties (= 7.0.8.1)
railties (= 7.1.5.1)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
Expand All @@ -377,13 +396,14 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
method_source
railties (7.1.5.1)
actionpack (= 7.1.5.1)
activesupport (= 7.1.5.1)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.3.0)
rake-compiler-dock (1.9.1)
Expand Down Expand Up @@ -461,6 +481,7 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
securerandom (0.4.1)
selenium-webdriver (4.34.0)
base64 (~> 0.2)
logger (~> 1.4)
Expand Down Expand Up @@ -524,7 +545,8 @@ GEM
bindex (>= 0.4.0)
railties (>= 6.0.0)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-driver (0.8.0)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
Expand Down Expand Up @@ -588,7 +610,7 @@ DEPENDENCIES
puma (~> 6.6)
pundit
rack-mini-profiler (~> 3.3)
rails (= 7.0.8.1)
rails (~> 7.1.5.1)
rails-html-sanitizer (~> 1.6.2)
rails4-autocomplete
rails_12factor
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/concerns/mailing_list_concerns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ module MailingListConcerns
module InstanceMethods
def subscribe_to_newsletter(member)
member.update(opt_in_newsletter_at: Time.zone.now)
MailingList.new(ENV['NEWSLETTER_ID']).subscribe(member.email,
member.name,
member.surname)
Services::MailingList.new(ENV['NEWSLETTER_ID']).subscribe(member.email,
member.name,
member.surname)
end

def unsubscribe_from_newsletter(member)
member.update(opt_in_newsletter_at: nil)
MailingList.new(ENV['NEWSLETTER_ID']).unsubscribe(member.email)
Services::MailingList.new(ENV['NEWSLETTER_ID']).unsubscribe(member.email)
end
end
end
11 changes: 6 additions & 5 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ def index
events << Event.past.includes(:venue, :sponsors).limit(RECENT_EVENTS_DISPLAY_LIMIT)
events = events.compact.flatten.sort_by(&:date_and_time).reverse.first(RECENT_EVENTS_DISPLAY_LIMIT)
events_hash_grouped_by_date = events.group_by(&:date)
@past_events = events_hash_grouped_by_date.map.inject({}) do |hash, (key, value)|
@past_events = events_hash_grouped_by_date.map.each_with_object({}) do |(key, value), hash|
hash[key] = EventPresenter.decorate_collection(value)
hash
end

events = [Workshop.includes(:chapter).upcoming.joins(:chapter).merge(Chapter.active)]
events << Meeting.upcoming.all
events << Event.upcoming.includes(:venue, :sponsors).all
events = events.compact.flatten.sort_by(&:date_and_time).group_by(&:date)
@events = events.map.inject({}) { |hash, (key, value)| hash[key] = EventPresenter.decorate_collection(value); hash }
@events = events.map.each_with_object({}) do |(key, value), hash|
hash[key] = EventPresenter.decorate_collection(value)
end
end

def show
Expand All @@ -34,7 +35,7 @@ def show
return unless logged_in?

invitation = Invitation.find_by(member: current_user, event: event, attending: true)
return redirect_to event_invitation_path(@event, invitation) if invitation
redirect_to event_invitation_path(@event, invitation) if invitation
end

def student
Expand All @@ -47,7 +48,7 @@ def coach

def rsvp
set_event
ticket = Ticket.new(request, params)
ticket = Services::Ticket.new(request, params)
member = Member.find_by(email: ticket.email)
invitation = member.invitations.where(event: @event, role: 'Student').try(:first)
invitation ||= Invitation.create(event: @event, member: member, role: 'Student')
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/event_invitation_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def attending(event, member, invitation)

require 'services/event_calendar'
attachments['codebar.ics'] = { mime_type: 'text/calendar',
content: EventCalendar.new(@event).calendar.to_ical }
content: Services::EventCalendar.new(@event).calendar.to_ical }

subject = "Your spot to #{@event.name} has been confirmed."

Expand Down
4 changes: 2 additions & 2 deletions app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class Contact < ApplicationRecord
validates :name, :surname, :email, presence: true

before_create :set_token
after_commit :subscribe_to_mailing_list, if: proc { |c| c.mailing_list_consent }
after_commit :unsubscribe_from_mailing_list, if: proc { |c| !c.mailing_list_consent }
after_commit :subscribe_to_mailing_list, if: proc { |c| c.mailing_list_consent }

def subscribe_to_mailing_list
mailing_list.subscribe(email, name, surname)
Expand All @@ -18,7 +18,7 @@ def unsubscribe_from_mailing_list
end

def mailing_list
@mailing_list ||= MailingList.new(ENV['SPONSOR_NEWSLETTER_ID'])
@mailing_list ||= Services::MailingList.new(ENV['SPONSOR_NEWSLETTER_ID'])
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Group < ApplicationRecord

validates :name, presence: true, inclusion: { in: NAMES, message: 'Invalid name for Group' }

alias_attribute :city, :chapter
alias city chapter

default_scope -> { joins(:chapter).includes(:chapter) }

Expand Down
4 changes: 2 additions & 2 deletions app/models/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def coach?
private

def subscribe_to_mailing_list
MailingList.new(group.mailing_list_id).subscribe(member.email, member.name, member.surname)
Services::MailingList.new(group.mailing_list_id).subscribe(member.email, member.name, member.surname)
end

def unsubscribe_from_mailing_list
MailingList.new(group.mailing_list_id).unsubscribe(member.email)
Services::MailingList.new(group.mailing_list_id).unsubscribe(member.email)
end
end
Loading
Loading