Martin Edenhofer 7 лет назад
Родитель
Сommit
ff56f294f3

+ 3 - 2
Gemfile

@@ -2,7 +2,7 @@ source 'https://rubygems.org'
 
 ruby '2.4.1'
 
-gem 'rails', '5.0.5'
+gem 'rails', '5.1.4'
 gem 'rails-observers'
 gem 'activerecord-session_store'
 
@@ -53,7 +53,8 @@ gem 'mime-types'
 
 gem 'biz'
 
-gem 'composite_primary_keys'
+# temporary till pull request gets merged: https://github.com/composite-primary-keys/composite_primary_keys/pull/404
+gem 'composite_primary_keys', git: 'https://github.com/jkowens/composite_primary_keys.git', branch: 'rails-5_1'
 gem 'delayed_job_active_record'
 gem 'daemons'
 

+ 54 - 48
Gemfile.lock

@@ -1,3 +1,11 @@
+GIT
+  remote: https://github.com/jkowens/composite_primary_keys.git
+  revision: 7f4670b54b3c6e94992161b4efe2c8717d7c0e71
+  branch: rails-5_1
+  specs:
+    composite_primary_keys (9.0.7)
+      activerecord (~> 5.1.0)
+
 GIT
   remote: https://github.com/thorsteneckel/autodiscover.git
   revision: 29d713ee0c8c25fcf74c4292ff13fe1fa4d0d827
@@ -17,38 +25,38 @@ GIT
 GEM
   remote: https://rubygems.org/
   specs:
-    actioncable (5.0.5)
-      actionpack (= 5.0.5)
-      nio4r (>= 1.2, < 3.0)
+    actioncable (5.1.4)
+      actionpack (= 5.1.4)
+      nio4r (~> 2.0)
       websocket-driver (~> 0.6.1)
-    actionmailer (5.0.5)
-      actionpack (= 5.0.5)
-      actionview (= 5.0.5)
-      activejob (= 5.0.5)
+    actionmailer (5.1.4)
+      actionpack (= 5.1.4)
+      actionview (= 5.1.4)
+      activejob (= 5.1.4)
       mail (~> 2.5, >= 2.5.4)
       rails-dom-testing (~> 2.0)
-    actionpack (5.0.5)
-      actionview (= 5.0.5)
-      activesupport (= 5.0.5)
+    actionpack (5.1.4)
+      actionview (= 5.1.4)
+      activesupport (= 5.1.4)
       rack (~> 2.0)
-      rack-test (~> 0.6.3)
+      rack-test (>= 0.6.3)
       rails-dom-testing (~> 2.0)
       rails-html-sanitizer (~> 1.0, >= 1.0.2)
-    actionview (5.0.5)
-      activesupport (= 5.0.5)
+    actionview (5.1.4)
+      activesupport (= 5.1.4)
       builder (~> 3.1)
-      erubis (~> 2.7.0)
+      erubi (~> 1.4)
       rails-dom-testing (~> 2.0)
       rails-html-sanitizer (~> 1.0, >= 1.0.3)
-    activejob (5.0.5)
-      activesupport (= 5.0.5)
+    activejob (5.1.4)
+      activesupport (= 5.1.4)
       globalid (>= 0.3.6)
-    activemodel (5.0.5)
-      activesupport (= 5.0.5)
-    activerecord (5.0.5)
-      activemodel (= 5.0.5)
-      activesupport (= 5.0.5)
-      arel (~> 7.0)
+    activemodel (5.1.4)
+      activesupport (= 5.1.4)
+    activerecord (5.1.4)
+      activemodel (= 5.1.4)
+      activesupport (= 5.1.4)
+      arel (~> 8.0)
     activerecord-nulldb-adapter (0.3.7)
       activerecord (>= 2.0.0)
     activerecord-session_store (1.1.0)
@@ -57,14 +65,14 @@ GEM
       multi_json (~> 1.11, >= 1.11.2)
       rack (>= 1.5.2, < 3)
       railties (>= 4.0, < 5.2)
-    activesupport (5.0.5)
+    activesupport (5.1.4)
       concurrent-ruby (~> 1.0, >= 1.0.2)
       i18n (~> 0.7)
       minitest (~> 5.1)
       tzinfo (~> 1.1)
     addressable (2.5.2)
       public_suffix (>= 2.0.2, < 4.0)
-    arel (7.1.4)
+    arel (8.0.0)
     argon2 (1.1.3)
       ffi (~> 1.9)
       ffi-compiler (~> 0.1)
@@ -94,8 +102,6 @@ GEM
       coffee-script
       execjs
       json
-    composite_primary_keys (9.0.7)
-      activerecord (~> 5.0.0)
     concurrent-ruby (1.0.5)
     coveralls (0.8.21)
       json (>= 1.8, < 3)
@@ -127,7 +133,7 @@ GEM
       eventmachine (>= 0.12.9)
       http_parser.rb (~> 0.6.0)
     equalizer (0.0.11)
-    erubis (2.7.0)
+    erubi (1.6.1)
     eventmachine (1.2.5)
     execjs (2.7.0)
     factory_girl (4.8.0)
@@ -219,7 +225,7 @@ GEM
       thread_safe (~> 0.3, >= 0.3.1)
     method_source (0.8.2)
     mime-types (2.99.3)
-    mini_portile2 (2.2.0)
+    mini_portile2 (2.3.0)
     minitest (5.10.3)
     multi_json (1.12.1)
     multi_xml (0.6.0)
@@ -231,8 +237,8 @@ GEM
     net-ldap (0.16.0)
     netrc (0.11.0)
     nio4r (2.1.0)
-    nokogiri (1.8.0)
-      mini_portile2 (~> 2.2.0)
+    nokogiri (1.8.1)
+      mini_portile2 (~> 2.3.0)
     nori (2.6.0)
     notiffany (0.1.1)
       nenv (~> 0.1)
@@ -294,19 +300,19 @@ GEM
     rack (2.0.3)
     rack-livereload (0.3.16)
       rack
-    rack-test (0.6.3)
-      rack (>= 1.0)
-    rails (5.0.5)
-      actioncable (= 5.0.5)
-      actionmailer (= 5.0.5)
-      actionpack (= 5.0.5)
-      actionview (= 5.0.5)
-      activejob (= 5.0.5)
-      activemodel (= 5.0.5)
-      activerecord (= 5.0.5)
-      activesupport (= 5.0.5)
+    rack-test (0.7.0)
+      rack (>= 1.0, < 3)
+    rails (5.1.4)
+      actioncable (= 5.1.4)
+      actionmailer (= 5.1.4)
+      actionpack (= 5.1.4)
+      actionview (= 5.1.4)
+      activejob (= 5.1.4)
+      activemodel (= 5.1.4)
+      activerecord (= 5.1.4)
+      activesupport (= 5.1.4)
       bundler (>= 1.3.0)
-      railties (= 5.0.5)
+      railties (= 5.1.4)
       sprockets-rails (>= 2.0.0)
     rails-dom-testing (2.0.3)
       activesupport (>= 4.2.0)
@@ -315,16 +321,16 @@ GEM
       loofah (~> 2.0)
     rails-observers (0.1.5)
       activemodel (>= 4.0)
-    railties (5.0.5)
-      actionpack (= 5.0.5)
-      activesupport (= 5.0.5)
+    railties (5.1.4)
+      actionpack (= 5.1.4)
+      activesupport (= 5.1.4)
       method_source
       rake (>= 0.8.7)
       thor (>= 0.18.1, < 2.0)
     rainbow (2.2.2)
       rake
     raindrops (0.19.0)
-    rake (12.0.0)
+    rake (12.1.0)
     rb-fsevent (0.10.2)
     rb-inotify (0.9.10)
       ffi (>= 0.5.0, < 2)
@@ -476,7 +482,7 @@ DEPENDENCIES
   coffee-rails
   coffee-script-source
   coffeelint
-  composite_primary_keys
+  composite_primary_keys!
   coveralls
   daemons
   delayed_job_active_record
@@ -516,7 +522,7 @@ DEPENDENCIES
   pre-commit
   puma
   rack-livereload
-  rails (= 5.0.5)
+  rails (= 5.1.4)
   rails-observers
   rb-fsevent
   rspec-rails

+ 1 - 1
app/controllers/long_polling_controller.rb

@@ -1,7 +1,7 @@
 # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
 
 class LongPollingController < ApplicationController
-  skip_action_callback :session_update # prevent race conditions
+  skip_before_action :session_update # prevent race conditions
 
   # GET /api/v1/message_send
   def message_send

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

@@ -55,7 +55,7 @@ returns
     }
 
     ignored_attributes = self.class.instance_variable_get(:@search_index_attributes_ignored) || []
-    return attributes if ignored_attributes.empty?
+    return attributes if ignored_attributes.blank?
 
     ignored_attributes.each { |attribute|
       attributes.delete(attribute.to_s)

+ 5 - 5
app/models/application_model/has_cache.rb

@@ -41,14 +41,14 @@ module ApplicationModel::HasCache
     }
 
     # delete old name / login caches
-    if changed?
-      if changes.key?('name')
-        name = changes['name'][0]
+    if saved_changes?
+      if saved_changes.key?('name')
+        name = saved_changes['name'][0]
         key = "#{self.class}::#{name}"
         Cache.delete(key)
       end
-      if changes.key?('login')
-        name = changes['login'][0]
+      if saved_changes.key?('login')
+        name = saved_changes['login'][0]
         key = "#{self.class}::#{name}"
         Cache.delete(key)
       end

+ 3 - 3
app/models/channel/email_parser.rb

@@ -475,7 +475,7 @@ returns
     # check ignore header
     if mail['x-zammad-ignore'.to_sym] == 'true' || mail['x-zammad-ignore'.to_sym] == true
       Rails.logger.info "ignored email with msgid '#{mail[:message_id]}' from '#{mail[:from]}' because of x-zammad-ignore header"
-      return true
+      return
     end
 
     # set interface handle
@@ -514,7 +514,7 @@ returns
         set_attributes_by_x_headers(ticket, 'ticket', mail, 'followup')
 
         # save changes set by x-zammad-ticket-followup-* headers
-        ticket.save if ticket.changed?
+        ticket.save! if ticket.has_changes_to_save?
 
         state      = Ticket::State.find(ticket.state_id)
         state_type = Ticket::StateType.find(state.state_type_id)
@@ -650,7 +650,7 @@ returns
 
   def self.sender_properties(from)
     data = {}
-
+    return data if from.blank?
     begin
       list = Mail::AddressList.new(from)
       list.addresses.each { |address|

+ 2 - 2
app/models/concerns/has_activity_stream_log.rb

@@ -32,13 +32,13 @@ log object update activity stream, if configured - will be executed automaticall
 =end
 
   def activity_stream_update
-    return true if !changed?
+    return true if !saved_changes?
 
     ignored_attributes  = self.class.instance_variable_get(:@activity_stream_attributes_ignored) || []
     ignored_attributes += %i(created_at updated_at created_by_id updated_by_id)
 
     log = false
-    changes.each { |key, _value|
+    saved_changes.each { |key, _value|
       next if ignored_attributes.include?(key.to_sym)
 
       log = true

+ 2 - 2
app/models/concerns/has_history.rb

@@ -33,13 +33,13 @@ log object update history with all updated attributes, if configured - will be e
 =end
 
   def history_update
-    return if !changed?
+    return if !saved_changes?
 
     # return if it's no update
     return if new_record?
 
     # new record also triggers update, so ignore new records
-    changes = self.changes
+    changes = saved_changes
     if history_changes_last_done
       history_changes_last_done.each { |key, value|
         if changes.key?(key) && changes[key] == value

+ 4 - 4
app/models/observer/sla/ticket_rebuild_escalation.rb

@@ -27,7 +27,7 @@ class Observer::Sla::TicketRebuildEscalation < ActiveRecord::Observer
   def _check(record)
 
     # return if we run import mode
-    return if Setting.get('import_mode') && !Setting.get('import_ignore_sla')
+    return true if Setting.get('import_mode') && !Setting.get('import_ignore_sla')
 
     # check if condition has changed
     changed = false
@@ -38,11 +38,11 @@ class Observer::Sla::TicketRebuildEscalation < ActiveRecord::Observer
                         %w(timezone business_hours default ical_url public_holidays)
                       end
     fields_to_check.each { |item|
-      next if !record.changes[item]
-      next if record.changes[item][0] == record.changes[item][1]
+      next if !record.saved_change_to_attribute(item)
+      next if record.saved_change_to_attribute(item)[0] == record.saved_change_to_attribute(item)[1]
       changed = true
     }
-    return if !changed
+    return true if !changed
 
     _rebuild(record)
   end

+ 1 - 1
app/models/observer/ticket/last_owner_update.rb

@@ -20,7 +20,7 @@ class Observer::Ticket::LastOwnerUpdate < ActiveRecord::Observer
 
     # check if owner has changed
     if type == 'update'
-      return true if record.changes['owner_id'].blank?
+      return true if record.changes_to_save['owner_id'].blank?
     end
 
     # check if owner is nobody

Некоторые файлы не были показаны из-за большого количества измененных файлов