2014-02-03 19:23:00 +00:00
|
|
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
2015-04-27 23:19:26 +00:00
|
|
|
class Ticket::Article < ApplicationModel
|
|
|
|
load 'ticket/article/assets.rb'
|
|
|
|
include Ticket::Article::Assets
|
|
|
|
load 'ticket/article/history_log.rb'
|
|
|
|
include Ticket::Article::HistoryLog
|
|
|
|
load 'ticket/article/activity_stream_log.rb'
|
|
|
|
include Ticket::Article::ActivityStreamLog
|
|
|
|
|
|
|
|
belongs_to :ticket
|
|
|
|
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-06-05 14:19:36 +00:00
|
|
|
store :preferences
|
2015-04-27 23:19:26 +00:00
|
|
|
before_create :check_subject
|
|
|
|
before_update :check_subject
|
|
|
|
notify_clients_support
|
|
|
|
|
|
|
|
activity_stream_support ignore_attributes: {
|
|
|
|
type_id: true,
|
|
|
|
sender_id: true,
|
2015-06-05 14:19:36 +00:00
|
|
|
preferences: true,
|
2015-04-27 23:19:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
history_support ignore_attributes: {
|
|
|
|
type_id: true,
|
|
|
|
sender_id: true,
|
2015-06-05 14:19:36 +00:00
|
|
|
preferences: true,
|
2015-04-27 23:19:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def check_subject
|
2015-04-30 15:25:04 +00:00
|
|
|
|
2015-05-07 12:10:38 +00:00
|
|
|
return if !subject
|
2015-04-30 15:25:04 +00:00
|
|
|
|
2015-05-07 12:10:38 +00:00
|
|
|
subject.gsub!(/\s|\t|\r/, ' ')
|
2015-04-27 23:19:26 +00:00
|
|
|
end
|
2015-01-07 21:28:15 +00:00
|
|
|
|
2015-04-27 23:19:26 +00:00
|
|
|
class Flag < ApplicationModel
|
|
|
|
end
|
2012-07-30 12:05:46 +00:00
|
|
|
|
2015-04-27 23:19:26 +00:00
|
|
|
class Sender < ApplicationModel
|
|
|
|
validates :name, presence: true
|
|
|
|
latest_change_support
|
|
|
|
end
|
2012-07-30 12:05:46 +00:00
|
|
|
|
2015-04-27 23:19:26 +00:00
|
|
|
class Type < ApplicationModel
|
|
|
|
validates :name, presence: true
|
|
|
|
latest_change_support
|
2012-07-30 12:05:46 +00:00
|
|
|
end
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|