Fixed ticket reload on server change. Moved to extra notify_clients_support method on models.
This commit is contained in:
parent
392dd59dc4
commit
7810ead783
9 changed files with 48 additions and 40 deletions
|
@ -14,6 +14,7 @@ class ApplicationModel < ActiveRecord::Base
|
||||||
|
|
||||||
after_create :cache_delete
|
after_create :cache_delete
|
||||||
after_update :cache_delete
|
after_update :cache_delete
|
||||||
|
after_touch :cache_delete
|
||||||
after_destroy :cache_delete
|
after_destroy :cache_delete
|
||||||
|
|
||||||
after_create :attachments_buffer_check
|
after_create :attachments_buffer_check
|
||||||
|
@ -418,6 +419,23 @@ returns
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
activate client notify support on create, update, touch and destroy
|
||||||
|
|
||||||
|
class Model < ApplicationModel
|
||||||
|
notify_clients_support
|
||||||
|
end
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def self.notify_clients_support
|
||||||
|
after_create :notify_clients_after_create
|
||||||
|
after_update :notify_clients_after_update
|
||||||
|
after_touch :notify_clients_after_update
|
||||||
|
after_destroy :notify_clients_after_destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
notify_clients_after_create after model got created
|
notify_clients_after_create after model got created
|
||||||
|
|
||||||
used as callback in model file
|
used as callback in model file
|
||||||
|
|
|
@ -9,9 +9,7 @@ class Job < ApplicationModel
|
||||||
before_create :updated_matching
|
before_create :updated_matching
|
||||||
before_update :updated_matching
|
before_update :updated_matching
|
||||||
|
|
||||||
after_create :notify_clients_after_create
|
notify_clients_support
|
||||||
after_update :notify_clients_after_update
|
|
||||||
after_destroy :notify_clients_after_destroy
|
|
||||||
|
|
||||||
def self.run
|
def self.run
|
||||||
time = Time.new
|
time = Time.new
|
||||||
|
@ -27,12 +25,12 @@ class Job < ApplicationModel
|
||||||
jobs = Job.where( :active => true )
|
jobs = Job.where( :active => true )
|
||||||
jobs.each do |job|
|
jobs.each do |job|
|
||||||
|
|
||||||
# only execute jobs, older then 2 min, to give admin posibility to change
|
# only execute jobs, older then 1 min, to give admin posibility to change
|
||||||
next if job.updated_at > Time.now - 2.minutes
|
next if job.updated_at > Time.now - 1.minutes
|
||||||
|
|
||||||
# check if jobs need to be executed
|
# check if jobs need to be executed
|
||||||
# ignore if job was running within last 10 min.
|
# ignore if job was running within last 10 min.
|
||||||
next if job.last_run_at > Time.now - 10.minutes
|
next if job.last_run_at && job.last_run_at > Time.now - 10.minutes
|
||||||
|
|
||||||
# check day
|
# check day
|
||||||
next if !job.timeplan['days'].include?( day_map[time.wday] )
|
next if !job.timeplan['days'].include?( day_map[time.wday] )
|
||||||
|
|
|
@ -11,11 +11,9 @@ class Organization < ApplicationModel
|
||||||
has_many :members, :class_name => 'User'
|
has_many :members, :class_name => 'User'
|
||||||
validates :name, :presence => true
|
validates :name, :presence => true
|
||||||
|
|
||||||
after_create :notify_clients_after_create
|
|
||||||
after_update :notify_clients_after_update
|
|
||||||
|
|
||||||
activity_stream_support :role => 'Admin'
|
activity_stream_support :role => 'Admin'
|
||||||
history_support
|
history_support
|
||||||
search_index_support
|
search_index_support
|
||||||
|
notify_clients_support
|
||||||
|
|
||||||
end
|
end
|
|
@ -3,7 +3,5 @@
|
||||||
class Template < ApplicationModel
|
class Template < ApplicationModel
|
||||||
store :options
|
store :options
|
||||||
validates :name, :presence => true
|
validates :name, :presence => true
|
||||||
after_create :notify_clients_after_create
|
notify_clients_support
|
||||||
after_update :notify_clients_after_update
|
end
|
||||||
after_destroy :notify_clients_after_destroy
|
|
||||||
end
|
|
|
@ -3,7 +3,5 @@
|
||||||
class TextModule < ApplicationModel
|
class TextModule < ApplicationModel
|
||||||
validates :name, :presence => true
|
validates :name, :presence => true
|
||||||
validates :content, :presence => true
|
validates :content, :presence => true
|
||||||
after_create :notify_clients_after_create
|
notify_clients_support
|
||||||
after_update :notify_clients_after_update
|
end
|
||||||
after_destroy :notify_clients_after_destroy
|
|
||||||
end
|
|
|
@ -17,9 +17,8 @@ class Ticket < ApplicationModel
|
||||||
before_create :check_generate, :check_defaults, :check_title
|
before_create :check_generate, :check_defaults, :check_title
|
||||||
before_update :check_defaults, :check_title
|
before_update :check_defaults, :check_title
|
||||||
before_destroy :destroy_dependencies
|
before_destroy :destroy_dependencies
|
||||||
after_create :notify_clients_after_create
|
|
||||||
after_update :notify_clients_after_update
|
notify_clients_support
|
||||||
after_destroy :notify_clients_after_destroy
|
|
||||||
|
|
||||||
activity_stream_support :ignore_attributes => {
|
activity_stream_support :ignore_attributes => {
|
||||||
:create_article_type_id => true,
|
:create_article_type_id => true,
|
||||||
|
|
|
@ -15,9 +15,7 @@ class Ticket::Article < ApplicationModel
|
||||||
belongs_to :updated_by, :class_name => 'User'
|
belongs_to :updated_by, :class_name => 'User'
|
||||||
before_create :check_subject
|
before_create :check_subject
|
||||||
before_update :check_subject
|
before_update :check_subject
|
||||||
after_create :notify_clients_after_create
|
notify_clients_support
|
||||||
after_update :notify_clients_after_update
|
|
||||||
after_destroy :notify_clients_after_destroy
|
|
||||||
|
|
||||||
activity_stream_support :ignore_attributes => {
|
activity_stream_support :ignore_attributes => {
|
||||||
:type_id => true,
|
:type_id => true,
|
||||||
|
|
|
@ -32,9 +32,10 @@ class User < ApplicationModel
|
||||||
|
|
||||||
before_create :check_name, :check_email, :check_login, :check_password
|
before_create :check_name, :check_email, :check_login, :check_password
|
||||||
before_update :check_password, :check_email, :check_login
|
before_update :check_password, :check_email, :check_login
|
||||||
after_create :avatar_check, :notify_clients_after_create
|
after_create :avatar_check
|
||||||
after_update :avatar_check, :notify_clients_after_update
|
after_update :avatar_check
|
||||||
after_destroy :avatar_destroy, :notify_clients_after_destroy
|
after_destroy :avatar_destroy
|
||||||
|
notify_clients_support
|
||||||
|
|
||||||
has_and_belongs_to_many :groups, :after_add => :cache_update, :after_remove => :cache_update
|
has_and_belongs_to_many :groups, :after_add => :cache_update, :after_remove => :cache_update
|
||||||
has_and_belongs_to_many :roles, :after_add => :cache_update, :after_remove => :cache_update
|
has_and_belongs_to_many :roles, :after_add => :cache_update, :after_remove => :cache_update
|
||||||
|
|
|
@ -16,14 +16,14 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
:execute => 'create_ticket',
|
:execute => 'create_ticket',
|
||||||
:group => 'Users',
|
:group => 'Users',
|
||||||
:subject => 'some subject 123äöü',
|
:subject => 'some subject 123äöü',
|
||||||
:body => 'some body 123äöü',
|
:body => 'some body 123äöü - with closed tab',
|
||||||
},
|
},
|
||||||
|
|
||||||
# check ticket
|
# check ticket
|
||||||
{
|
{
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
:css => '.content.active .ticket-article',
|
:css => '.content.active .ticket-article',
|
||||||
:value => 'some body 123äöü',
|
:value => 'some body 123äöü - with closed tab',
|
||||||
:match_result => true,
|
:match_result => true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
#},
|
#},
|
||||||
{
|
{
|
||||||
:execute => 'set_ticket_attributes',
|
:execute => 'set_ticket_attributes',
|
||||||
:body => 'some body 1234 äöüß',
|
:body => 'some body 1234 äöüß - with closed tab',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'click',
|
:execute => 'click',
|
||||||
|
@ -57,7 +57,7 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
{
|
{
|
||||||
:execute => 'watch_for',
|
:execute => 'watch_for',
|
||||||
:area => '.content.active .ticket-article',
|
:area => '.content.active .ticket-article',
|
||||||
:value => 'some body 1234 äöüß',
|
:value => 'some body 1234 äöüß - with closed tab',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'close_all_tasks',
|
:execute => 'close_all_tasks',
|
||||||
|
@ -74,14 +74,14 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
:execute => 'create_ticket',
|
:execute => 'create_ticket',
|
||||||
:group => 'Users',
|
:group => 'Users',
|
||||||
:subject => 'test to merge',
|
:subject => 'test to merge',
|
||||||
:body => 'some body 123äöü 222 - test to merge',
|
:body => 'some body 123äöü 222 - test to merge - with closed tab',
|
||||||
},
|
},
|
||||||
|
|
||||||
# check ticket
|
# check ticket
|
||||||
{
|
{
|
||||||
:execute => 'watch_for',
|
:execute => 'watch_for',
|
||||||
:area => '.content.active .ticket-article',
|
:area => '.content.active .ticket-article',
|
||||||
:value => 'some body 123äöü 222 - test to merge',
|
:value => 'some body 123äöü 222 - test to merge - with closed tab',
|
||||||
},
|
},
|
||||||
|
|
||||||
# update ticket
|
# update ticket
|
||||||
|
@ -92,7 +92,7 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
#},
|
#},
|
||||||
{
|
{
|
||||||
:execute => 'set_ticket_attributes',
|
:execute => 'set_ticket_attributes',
|
||||||
:body => 'some body 1234 äöüß 333',
|
:body => 'some body 1234 äöüß 333 - with closed tab',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'click',
|
:execute => 'click',
|
||||||
|
@ -105,7 +105,7 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
{
|
{
|
||||||
:execute => 'watch_for',
|
:execute => 'watch_for',
|
||||||
:area => '.content.active .ticket-article',
|
:area => '.content.active .ticket-article',
|
||||||
:value => 'some body 1234 äöüß 333',
|
:value => 'some body 1234 äöüß 333 - with closed tab',
|
||||||
},
|
},
|
||||||
|
|
||||||
# check if task is shown
|
# check if task is shown
|
||||||
|
@ -158,7 +158,7 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
{
|
{
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
:css => 'body',
|
:css => 'body',
|
||||||
:value => 'test to merge',
|
:value => 'test to merge - with closed tab',
|
||||||
:match_result => true,
|
:match_result => true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -186,14 +186,14 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
:execute => 'create_ticket',
|
:execute => 'create_ticket',
|
||||||
:group => 'Users',
|
:group => 'Users',
|
||||||
:subject => 'some subject 123äöü',
|
:subject => 'some subject 123äöü',
|
||||||
:body => 'some body 123äöü',
|
:body => 'some body 123äöü - with open tab',
|
||||||
},
|
},
|
||||||
|
|
||||||
# check ticket
|
# check ticket
|
||||||
{
|
{
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
:css => '.content.active .ticket-article',
|
:css => '.content.active .ticket-article',
|
||||||
:value => 'some body 123äöü',
|
:value => 'some body 123äöü - with open tab',
|
||||||
:match_result => true,
|
:match_result => true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -218,14 +218,14 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
:execute => 'create_ticket',
|
:execute => 'create_ticket',
|
||||||
:group => 'Users',
|
:group => 'Users',
|
||||||
:subject => 'test to merge',
|
:subject => 'test to merge',
|
||||||
:body => 'some body 123äöü 222 - test to merge',
|
:body => 'some body 123äöü 222 - test to merge - with open tab',
|
||||||
},
|
},
|
||||||
|
|
||||||
# check ticket
|
# check ticket
|
||||||
{
|
{
|
||||||
:execute => 'watch_for',
|
:execute => 'watch_for',
|
||||||
:area => '.content.active .ticket-article',
|
:area => '.content.active .ticket-article',
|
||||||
:value => 'some body 123äöü 222 - test to merge',
|
:value => 'some body 123äöü 222 - test to merge - with open tab',
|
||||||
},
|
},
|
||||||
|
|
||||||
# check if task is shown
|
# check if task is shown
|
||||||
|
@ -278,7 +278,7 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
{
|
{
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
:css => 'body',
|
:css => 'body',
|
||||||
:value => 'test to merge',
|
:value => 'test to merge - with open tab',
|
||||||
:match_result => true,
|
:match_result => true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue