Browse Source

Maintenance: Update to Rails 7.0

Mantas Masalskis 1 year ago
parent
commit
8d39f68f59

+ 4 - 1
Gemfile

@@ -4,7 +4,7 @@ source 'https://rubygems.org'
 
 # core - base
 ruby '3.1.3'
-gem 'rails', '~> 6.1.0'
+gem 'rails', '~> 7.0.8'
 
 # TEMPORARY Security updates from Ruby 3.1.4. Can be removed when updating from Ruby 3.1.3 to a higher version.
 # See also: https://www.ruby-lang.org/en/news/2023/03/30/ruby-3-1-4-released/
@@ -67,6 +67,9 @@ gem 'dalli', require: false
 # Vite is required by the web server
 gem 'vite_rails'
 
+# asset handling - config.assets for pipeline
+gem 'sprockets-rails'
+
 # Only load gems for asset compilation if they are needed to avoid
 #   having unneeded runtime dependencies like NodeJS.
 group :assets do

+ 68 - 61
Gemfile.lock

@@ -24,52 +24,59 @@ GEM
       simple_po_parser (~> 1.1.6)
     aasm (5.5.0)
       concurrent-ruby (~> 1.0)
-    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)
-    activerecord (6.1.7.6)
-      activemodel (= 6.1.7.6)
-      activesupport (= 6.1.7.6)
+    activemodel (7.0.8)
+      activesupport (= 7.0.8)
+    activerecord (7.0.8)
+      activemodel (= 7.0.8)
+      activesupport (= 7.0.8)
     activerecord-import (1.5.0)
       activerecord (>= 4.2)
     activerecord-nulldb-adapter (0.9.0)
@@ -81,19 +88,18 @@ GEM
       multi_json (~> 1.11, >= 1.11.2)
       rack (>= 2.0.8, < 4)
       railties (>= 6.1)
-    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)
     acts_as_list (1.1.0)
       activerecord (>= 4.2)
     addressable (2.8.5)
@@ -161,8 +167,8 @@ GEM
       coffee-script-source
       execjs
     coffee-script-source (1.12.2)
-    composite_primary_keys (13.0.7)
-      activerecord (~> 6.1.0)
+    composite_primary_keys (14.0.6)
+      activerecord (~> 7.0.2)
     concurrent-ruby (1.2.2)
     cose (1.3.0)
       cbor (~> 0.5.9)
@@ -245,8 +251,8 @@ GEM
       ffi (>= 1.0.0)
       rake
     gli (2.21.1)
-    globalid (1.1.0)
-      activesupport (>= 5.0)
+    globalid (1.2.1)
+      activesupport (>= 6.1)
     gmail_xoauth (0.4.2)
       oauth (>= 0.3.6)
     graphql (2.1.1)
@@ -446,21 +452,20 @@ GEM
       rack
     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)
@@ -472,12 +477,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.0.6)
     rb-fsevent (0.11.2)
@@ -764,7 +770,7 @@ DEPENDENCIES
   pundit
   pundit-matchers
   rack-attack
-  rails (~> 6.1.0)
+  rails (~> 7.0.8)
   rails-controller-testing
   rchardet (>= 1.8.0)
   redis (>= 3, < 5)
@@ -786,6 +792,7 @@ DEPENDENCIES
   slack-notifier
   slack-ruby-client
   sprockets (~> 3.7.2)
+  sprockets-rails
   tcr
   telegram-bot-ruby
   telephone_number

+ 0 - 1
app/controllers/application_controller/handles_transitions.rb

@@ -17,7 +17,6 @@ module ApplicationController::HandlesTransitions
 
     TransactionDispatcher.commit
     PushMessages.finish
-    ActiveSupport::Dependencies::Reference.clear!
   ensure
     ApplicationHandleInfo.current = nil
   end

+ 1 - 1
app/controllers/user_agent_test_basic_auth_controller.rb

@@ -1,5 +1,5 @@
 # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
 
 class UserAgentTestBasicAuthController < UserAgentTestController
-  http_basic_authenticate_with name: ENV['CI_BASIC_AUTH_USER'], password: ENV['CI_BASIC_AUTH_PASSWORD']
+  http_basic_authenticate_with name: ENV['CI_BASIC_AUTH_USER'] || '', password: ENV['CI_BASIC_AUTH_PASSWORD'] || ''
 end

+ 1 - 1
app/controllers/user_agent_test_controller.rb

@@ -41,7 +41,7 @@ class UserAgentTestController < ApplicationController
 
     render json:   {
              remote_ip:              request.remote_ip,
-             content_type_requested: request.content_type,
+             content_type_requested: request.media_type,
              method:                 type,
              submitted:              params[:submitted]
            },

+ 1 - 1
app/models/application_model/can_latest_change.rb

@@ -19,7 +19,7 @@ returns
 =end
 
     def latest_change
-      maximum(:updated_at)&.to_s(:nsec)
+      maximum(:updated_at)&.to_fs(:nsec)
     end
   end
 end

+ 4 - 0
app/models/core_workflow/result.rb

@@ -6,6 +6,10 @@ class CoreWorkflow::Result
   attr_accessor :payload, :payload_backup, :user, :assets, :assets_in_result, :result, :rerun, :form_updater, :restricted_fields
 
   def initialize(payload:, user:, assets: {}, assets_in_result: true, result: {}, form_updater: false)
+    if payload.respond_to?(:permit!)
+      payload = payload.permit!.to_h
+    end
+
     raise ArgumentError, __("The required parameter 'payload->class_name' is missing.") if !payload['class_name']
     raise ArgumentError, __("The required parameter 'payload->screen' is missing.") if !payload['screen']
 

+ 4 - 0
app/models/cti/log.rb

@@ -506,6 +506,10 @@ optional you can put the max oldest chat entries as argument
       super.merge(virtual_attributes)
     end
 
+    def attribute_names_for_serialization
+      super + %w[from_pretty to_pretty]
+    end
+
     def set_pretty
       %i[from to].each do |field|
         parsed = TelephoneNumber.parse(send(field)&.sub(%r{^\+?}, '+'))

+ 1 - 1
app/models/ticket/article/adds_metadata_email.rb

@@ -47,7 +47,7 @@ module Ticket::Article::AddsMetadataEmail
     # generate message id, force it in production, in test allow to set it for testing reasons
     if !message_id || Rails.env.production?
       fqdn = Setting.get('fqdn')
-      self.message_id = "<#{DateTime.current.to_s(:number)}.#{ticket_id}.#{SecureRandom.uuid}@#{fqdn}>"
+      self.message_id = "<#{DateTime.current.to_fs(:number)}.#{ticket_id}.#{SecureRandom.uuid}@#{fqdn}>"
     end
 
     # generate message_id_md5

+ 1 - 1
app/models/transaction/notification.rb

@@ -225,7 +225,7 @@ class Transaction::Notification
           changes:      changes,
           reason:       recipients_reason[user.id],
         },
-        message_id:  "<notification.#{DateTime.current.to_s(:number)}.#{ticket.id}.#{user.id}.#{SecureRandom.uuid}@#{Setting.get('fqdn')}>",
+        message_id:  "<notification.#{DateTime.current.to_fs(:number)}.#{ticket.id}.#{user.id}.#{SecureRandom.uuid}@#{Setting.get('fqdn')}>",
         references:  ticket.get_references,
         main_object: ticket,
         attachments: attachments,

Some files were not shown because too many files changed in this diff