Moved to support client notify via module application base.
This commit is contained in:
parent
dcd01d5862
commit
53a0ee3eab
5 changed files with 12 additions and 33 deletions
|
@ -1,29 +0,0 @@
|
|||
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require 'session'
|
||||
|
||||
class Observer::WebSocketNotify < ActiveRecord::Observer
|
||||
observe :ticket, :user, 'ticket::_article'
|
||||
|
||||
def after_create(record)
|
||||
|
||||
# return if we run import mode
|
||||
return if Setting.get('import_mode')
|
||||
|
||||
Session.broadcast(
|
||||
:event => record.class.name.downcase + ':created',
|
||||
:data => { :id => record.id, :updated_at => record.updated_at }
|
||||
)
|
||||
end
|
||||
|
||||
def after_update(record)
|
||||
|
||||
# return if we run import mode
|
||||
return if Setting.get('import_mode')
|
||||
puts "#{record.class.name.downcase} UPDATED " + record.updated_at.to_s
|
||||
Session.broadcast(
|
||||
:event => record.class.name.downcase + ':updated',
|
||||
:data => { :id => record.id, :updated_at => record.updated_at }
|
||||
)
|
||||
end
|
||||
end
|
|
@ -7,6 +7,9 @@ class Ticket < ApplicationModel
|
|||
before_create :number_generate, :check_defaults
|
||||
before_update :check_defaults
|
||||
before_destroy :destroy_dependencies
|
||||
after_create :notify_clients_after_create
|
||||
after_update :notify_clients_after_update
|
||||
after_destroy :notify_clients_after_destroy
|
||||
|
||||
belongs_to :group
|
||||
has_many :articles, :class_name => 'Ticket::Article', :after_add => :cache_update, :after_remove => :cache_update
|
||||
|
|
|
@ -6,6 +6,9 @@ class Ticket::Article < ApplicationModel
|
|||
belongs_to :ticket_article_type, :class_name => 'Ticket::Article::Type'
|
||||
belongs_to :ticket_article_sender, :class_name => 'Ticket::Article::Sender'
|
||||
belongs_to :created_by, :class_name => 'User'
|
||||
after_create :notify_clients_after_create
|
||||
after_update :notify_clients_after_update
|
||||
after_destroy :notify_clients_after_destroy
|
||||
|
||||
attr_accessor :attachments
|
||||
|
||||
|
|
|
@ -6,8 +6,11 @@ require 'organization'
|
|||
class User < ApplicationModel
|
||||
include Gmaps
|
||||
|
||||
before_create :check_name, :check_email, :check_login, :check_image, :check_geo, :check_password
|
||||
before_update :check_password, :check_image, :check_geo, :check_email, :check_login_update
|
||||
before_create :check_name, :check_email, :check_login, :check_image, :check_geo, :check_password
|
||||
before_update :check_password, :check_image, :check_geo, :check_email, :check_login_update
|
||||
after_create :notify_clients_after_create
|
||||
after_update :notify_clients_after_update
|
||||
after_destroy :notify_clients_after_destroy
|
||||
|
||||
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
|
||||
|
|
|
@ -41,8 +41,7 @@ module Zammad
|
|||
'observer::_ticket::_notification',
|
||||
'observer::_tag::_ticket_history',
|
||||
'observer::_ticket::_reset_new_state',
|
||||
'observer::_ticket::_escalation_calculation',
|
||||
'observer::_web_socket_notify'
|
||||
'observer::_ticket::_escalation_calculation'
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
|
|
Loading…
Reference in a new issue