Do not touch ticket on user or organization change.
This commit is contained in:
parent
258130d824
commit
679b90aaec
3 changed files with 2 additions and 31 deletions
|
@ -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
|
||||
|
|
|
@ -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" )
|
||||
|
|
|
@ -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" )
|
||||
|
|
Loading…
Reference in a new issue