Moved to global Observer::Transaction.commit which executes model based transitions.
This commit is contained in:
parent
ef64d1e1d7
commit
6d02578d61
11 changed files with 109 additions and 97 deletions
|
@ -51,7 +51,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
# execute events
|
# execute events
|
||||||
def trigger_events
|
def trigger_events
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finds the User with the ID stored in the session with the key
|
# Finds the User with the ID stored in the session with the key
|
||||||
|
|
|
@ -486,8 +486,8 @@ retrns
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# execute ticket notification events
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
|
|
||||||
# run postmaster post filter
|
# run postmaster post filter
|
||||||
Setting.where(area: 'Postmaster::PostFilter').order(:name).each {|setting|
|
Setting.where(area: 'Postmaster::PostFilter').order(:name).each {|setting|
|
||||||
|
|
|
@ -60,10 +60,10 @@ class Job < ApplicationModel
|
||||||
next if !changed
|
next if !changed
|
||||||
ticket.save
|
ticket.save
|
||||||
|
|
||||||
# execute ticket notification events
|
# execute ticket transaction
|
||||||
if !job.disable_notification
|
Observer::Ticket::Transaction.commit(
|
||||||
Observer::Ticket::Notification.transaction
|
disable_notification: job.disable_notification
|
||||||
end
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,9 @@ require 'notification_factory'
|
||||||
class Observer::Ticket::Notification < ActiveRecord::Observer
|
class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
observe :ticket, 'ticket::_article'
|
observe :ticket, 'ticket::_article'
|
||||||
|
|
||||||
def self.transaction
|
def self.transaction(params)
|
||||||
|
|
||||||
|
return if params[:disable_notification]
|
||||||
|
|
||||||
# return if we run import mode
|
# return if we run import mode
|
||||||
return if Setting.get('import_mode')
|
return if Setting.get('import_mode')
|
||||||
|
|
10
app/models/observer/transaction.rb
Normal file
10
app/models/observer/transaction.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
class Observer::Transaction
|
||||||
|
|
||||||
|
def self.commit(params = {})
|
||||||
|
|
||||||
|
# execute ticket transactions
|
||||||
|
Observer::Ticket::Notification.transaction(params)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -157,8 +157,8 @@ returns
|
||||||
ticket.save!
|
ticket.save!
|
||||||
|
|
||||||
# we do not have an destructor at this point, so we need to
|
# we do not have an destructor at this point, so we need to
|
||||||
# execute ticket events manually
|
# execute object transaction manually
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
|
|
||||||
result.push ticket
|
result.push ticket
|
||||||
}
|
}
|
||||||
|
@ -473,7 +473,7 @@ condition example
|
||||||
end
|
end
|
||||||
|
|
||||||
# validate pre_condition values
|
# validate pre_condition values
|
||||||
return nil if selector['pre_condition'] && selector['pre_condition'] !~ /^(set|current_user\.|specific)/
|
return nil if selector['pre_condition'] && selector['pre_condition'] !~ /^(not_set|current_user\.|specific)/
|
||||||
|
|
||||||
# get attributes
|
# get attributes
|
||||||
attributes = attribute.split(/\./)
|
attributes = attribute.split(/\./)
|
||||||
|
@ -484,7 +484,7 @@ condition example
|
||||||
end
|
end
|
||||||
|
|
||||||
if selector['operator'] == 'is'
|
if selector['operator'] == 'is'
|
||||||
if selector['pre_condition'] == 'set'
|
if selector['pre_condition'] == 'not_set'
|
||||||
if attributes[1] =~ /^(created_by|updated_by|owner|customer|user)_id/
|
if attributes[1] =~ /^(created_by|updated_by|owner|customer|user)_id/
|
||||||
query += "#{attribute} NOT IN (?)"
|
query += "#{attribute} NOT IN (?)"
|
||||||
bind_params.push 1
|
bind_params.push 1
|
||||||
|
@ -511,7 +511,7 @@ condition example
|
||||||
# rubocop:enable Style/IfInsideElse
|
# rubocop:enable Style/IfInsideElse
|
||||||
end
|
end
|
||||||
elsif selector['operator'] == 'is not'
|
elsif selector['operator'] == 'is not'
|
||||||
if selector['pre_condition'] == 'set'
|
if selector['pre_condition'] == 'not_set'
|
||||||
if attributes[1] =~ /^(created_by|updated_by|owner|customer|user)_id/
|
if attributes[1] =~ /^(created_by|updated_by|owner|customer|user)_id/
|
||||||
query += "#{attribute} IN (?)"
|
query += "#{attribute} IN (?)"
|
||||||
bind_params.push 1
|
bind_params.push 1
|
||||||
|
|
|
@ -296,8 +296,8 @@ result
|
||||||
end
|
end
|
||||||
to_article(post, ticket, page)
|
to_article(post, ticket, page)
|
||||||
|
|
||||||
# execute ticket events
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
end
|
end
|
||||||
|
|
||||||
ticket
|
ticket
|
||||||
|
|
|
@ -235,8 +235,8 @@ class TweetBase
|
||||||
raise "Unknown tweet type '#{tweet.class}'"
|
raise "Unknown tweet type '#{tweet.class}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
# execute ticket events
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
end
|
end
|
||||||
|
|
||||||
if @connection_type == 'stream'
|
if @connection_type == 'stream'
|
||||||
|
|
|
@ -171,8 +171,8 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# execute ticket events
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
|
|
||||||
# execute background jobs
|
# execute background jobs
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
|
@ -60,8 +60,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
tickets = []
|
tickets = []
|
||||||
tickets.push ticket1
|
tickets.push ticket1
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
updated_by_id: customer_user.id,
|
updated_by_id: customer_user.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
tickets = []
|
tickets = []
|
||||||
tickets.push ticket2
|
tickets.push ticket2
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
updated_by_id: customer_user.id,
|
updated_by_id: customer_user.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -173,8 +173,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
# remember ticket
|
# remember ticket
|
||||||
tickets.push ticket3
|
tickets.push ticket3
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
updated_by_id: customer_user.id,
|
updated_by_id: customer_user.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -217,8 +217,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
internal: false
|
internal: false
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -256,8 +256,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
# remember ticket
|
# remember ticket
|
||||||
tickets.push ticket4
|
tickets.push ticket4
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
updated_by_id: customer_user.id,
|
updated_by_id: customer_user.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -312,8 +312,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
# remember ticket
|
# remember ticket
|
||||||
tickets.push ticket5
|
tickets.push ticket5
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -331,8 +331,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
updated_by_id: customer_user.id,
|
updated_by_id: customer_user.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,9 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
assert(ticket1)
|
assert(ticket1)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Rails.configuration.webserver_is_active = nil
|
Rails.configuration.webserver_is_active = nil
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
assert(ticket1)
|
assert(ticket1)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Rails.configuration.webserver_is_active = true
|
Rails.configuration.webserver_is_active = true
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -158,9 +158,9 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
assert( ticket1, 'ticket created - ticket notification simple' )
|
assert( ticket1, 'ticket created - ticket notification simple' )
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Rails.configuration.webserver_is_active = true
|
Rails.configuration.webserver_is_active = true
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -173,8 +173,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket1.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket1.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket1.save
|
ticket1.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -195,8 +195,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: agent1.id,
|
created_by_id: agent1.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: agent1.id,
|
created_by_id: agent1.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -254,8 +254,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: agent1.id,
|
created_by_id: agent1.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
assert(ticket2, 'ticket created')
|
assert(ticket2, 'ticket created')
|
||||||
|
@ -270,8 +270,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket2.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket2.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket2.save
|
ticket2.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -285,8 +285,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket2.priority = Ticket::Priority.lookup(name: '2 normal')
|
ticket2.priority = Ticket::Priority.lookup(name: '2 normal')
|
||||||
ticket2.save
|
ticket2.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -319,8 +319,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: agent2.id,
|
created_by_id: agent2.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
assert(ticket3, 'ticket created')
|
assert(ticket3, 'ticket created')
|
||||||
|
@ -335,8 +335,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket3.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket3.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket3.save
|
ticket3.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -350,8 +350,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket3.priority = Ticket::Priority.lookup(name: '2 normal')
|
ticket3.priority = Ticket::Priority.lookup(name: '2 normal')
|
||||||
ticket3.save
|
ticket3.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -363,8 +363,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
article_inbound.internal = true
|
article_inbound.internal = true
|
||||||
article_inbound.save
|
article_inbound.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -425,9 +425,9 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: customer.id,
|
created_by_id: customer.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Rails.configuration.webserver_is_active = false
|
Rails.configuration.webserver_is_active = false
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -440,8 +440,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket1.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket1.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket1.save
|
ticket1.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -474,8 +474,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: customer.id,
|
created_by_id: customer.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -488,8 +488,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket2.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket2.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket2.save
|
ticket2.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -522,8 +522,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: customer.id,
|
created_by_id: customer.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -536,8 +536,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket3.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket3.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket3.save
|
ticket3.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -587,9 +587,9 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: customer.id,
|
created_by_id: customer.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Rails.configuration.webserver_is_active = false
|
Rails.configuration.webserver_is_active = false
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -602,8 +602,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket4.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket4.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket4.save
|
ticket4.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -653,9 +653,9 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: customer.id,
|
created_by_id: customer.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Rails.configuration.webserver_is_active = false
|
Rails.configuration.webserver_is_active = false
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -668,8 +668,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket5.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket5.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket5.save
|
ticket5.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -720,9 +720,9 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: customer.id,
|
created_by_id: customer.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Rails.configuration.webserver_is_active = false
|
Rails.configuration.webserver_is_active = false
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -737,8 +737,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket6.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket6.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket6.save
|
ticket6.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -799,9 +799,9 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: customer.id,
|
created_by_id: customer.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Rails.configuration.webserver_is_active = false
|
Rails.configuration.webserver_is_active = false
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -816,8 +816,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
ticket7.priority = Ticket::Priority.lookup(name: '3 high')
|
ticket7.priority = Ticket::Priority.lookup(name: '3 high')
|
||||||
ticket7.save
|
ticket7.save
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
||||||
|
@ -856,8 +856,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
assert(ticket1, 'ticket created')
|
assert(ticket1, 'ticket created')
|
||||||
|
|
||||||
# execute ticket transaction
|
# execute object transaction
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Transaction.commit
|
||||||
|
|
||||||
# update ticket attributes
|
# update ticket attributes
|
||||||
ticket1.title = "#{ticket1.title} - #2"
|
ticket1.title = "#{ticket1.title} - #2"
|
||||||
|
|
Loading…
Reference in a new issue