2014-02-03 19:23:00 +00:00
|
|
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-07-30 12:05:46 +00:00
|
|
|
class Ticket::Article < ApplicationModel
|
2014-10-17 12:15:54 +00:00
|
|
|
load 'ticket/article/assets.rb'
|
2013-08-19 06:29:49 +00:00
|
|
|
include Ticket::Article::Assets
|
2014-10-17 12:15:54 +00:00
|
|
|
load 'ticket/article/history_log.rb'
|
2013-09-25 19:50:28 +00:00
|
|
|
include Ticket::Article::HistoryLog
|
2014-10-17 12:15:54 +00:00
|
|
|
load 'ticket/article/activity_stream_log.rb'
|
2013-09-29 21:37:49 +00:00
|
|
|
include Ticket::Article::ActivityStreamLog
|
2013-08-19 06:29:49 +00:00
|
|
|
|
2012-07-30 12:05:46 +00:00
|
|
|
belongs_to :ticket
|
2015-04-27 13:42:53 +00:00
|
|
|
belongs_to :type, class_name: 'Ticket::Article::Type'
|
|
|
|
belongs_to :sender, class_name: 'Ticket::Article::Sender'
|
|
|
|
belongs_to :created_by, class_name: 'User'
|
|
|
|
belongs_to :updated_by, class_name: 'User'
|
2015-01-07 21:28:15 +00:00
|
|
|
before_create :check_subject
|
|
|
|
before_update :check_subject
|
2015-02-01 12:08:11 +00:00
|
|
|
notify_clients_support
|
2012-07-30 12:05:46 +00:00
|
|
|
|
2015-04-27 13:42:53 +00:00
|
|
|
activity_stream_support ignore_attributes: {
|
|
|
|
type_id: true,
|
|
|
|
sender_id: true,
|
2013-10-05 12:56:03 +00:00
|
|
|
}
|
2013-09-29 21:37:49 +00:00
|
|
|
|
2015-04-27 13:42:53 +00:00
|
|
|
history_support ignore_attributes: {
|
|
|
|
type_id: true,
|
|
|
|
sender_id: true,
|
2013-09-29 21:37:49 +00:00
|
|
|
}
|
2013-09-28 00:07:11 +00:00
|
|
|
|
2015-01-07 21:28:15 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def check_subject
|
|
|
|
if self.subject
|
|
|
|
self.subject.gsub!(/\s|\t|\r/, ' ')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-30 12:05:46 +00:00
|
|
|
class Flag < ApplicationModel
|
|
|
|
end
|
|
|
|
|
|
|
|
class Sender < ApplicationModel
|
2015-04-27 13:42:53 +00:00
|
|
|
validates :name, presence: true
|
2015-02-25 20:52:14 +00:00
|
|
|
latest_change_support
|
2012-07-30 12:05:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
class Type < ApplicationModel
|
2015-04-27 13:42:53 +00:00
|
|
|
validates :name, presence: true
|
2015-02-25 20:52:14 +00:00
|
|
|
latest_change_support
|
2012-07-30 12:05:46 +00:00
|
|
|
end
|
2015-02-25 20:52:14 +00:00
|
|
|
end
|