Просмотр исходного кода

Do not touch ticket on user or organization change.

Martin Edenhofer 10 лет назад
Родитель
Сommit
679b90aaec

+ 0 - 15
app/models/observer/user/ref_object_touch.rb

@@ -18,11 +18,6 @@ class Observer::User::RefObjectTouch < ActiveRecord::Observer
     # return if we run import mode
     return if Setting.get('import_mode')
 
-    # touch customers tickets
-    Ticket.select('id').where( :customer_id => record.id ).each {|ticket|
-      ticket.touch
-    }
-
     # touch old organization if changed
     member_ids = []
     organization_id_changed = record.changes['organization_id']
@@ -31,11 +26,6 @@ class Observer::User::RefObjectTouch < ActiveRecord::Observer
         organization = Organization.find( organization_id_changed[0] )
         organization.touch
         member_ids = organization.member_ids
-
-        # touch customers tickets
-        Ticket.select('id').where( :organization_id => organization.id ).each {|ticket|
-          ticket.touch
-        }
       end
     end
 
@@ -43,11 +33,6 @@ class Observer::User::RefObjectTouch < ActiveRecord::Observer
     if record.organization
       record.organization.touch
       member_ids += record.organization.member_ids
-
-      # touch customers tickets
-      Ticket.select('id').where( :organization_id => record.organization_id ).each {|ticket|
-        ticket.touch
-      }
     end
 
     # touch old/current customer

+ 1 - 8
test/unit/organization_ref_object_touch_test.rb

@@ -100,7 +100,7 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
     customer2.organization_id = organization1.id
     customer2.save
 
-    # check if customer1, ticket and organization has been touched
+    # check if customer1 and organization has been touched
     customer1 = User.find(customer1.id)
     if customer1.updated_at > 2.second.ago
       assert( true, "customer1.updated_at has been updated" )
@@ -108,13 +108,6 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
       assert( false, "customer1.updated_at has not been updated" )
     end
 
-    ticket = Ticket.find(ticket.id)
-    if ticket.updated_at > 2.second.ago
-      assert( true, "ticket.updated_at has been updated" )
-    else
-      assert( false, "ticket.updated_at has not been updated" )
-    end
-
     organization1 = Organization.find(organization1.id)
     if organization1.updated_at > 2.second.ago
       assert( true, "organization1.updated_at has been updated" )

+ 1 - 8
test/unit/user_ref_object_touch_test.rb

@@ -74,14 +74,7 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
     customer1.firstname = 'firstname customer1'
     customer1.save
 
-    # check if ticket and organization has been touched
-    ticket = Ticket.find(ticket.id)
-    if ticket.updated_at > 2.second.ago
-      assert( true, "ticket.updated_at has been updated" )
-    else
-      assert( false, "ticket.updated_at has not been updated" )
-    end
-
+    # check if organization has been touched
     organization1 = Organization.find(organization1.id)
     if organization1.updated_at > 2.second.ago
       assert( true, "organization1.updated_at has been updated" )