|
|
|
@ -51,7 +51,7 @@ class Issue < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
acts_as_nested_set :scope => 'root_id', :dependent => :destroy
|
|
|
|
|
acts_as_attachable :after_add => :attachment_added, :after_remove => :attachment_removed
|
|
|
|
|
acts_as_attachable :before_add => :attachment_added, :after_remove => :attachment_removed
|
|
|
|
|
acts_as_customizable
|
|
|
|
|
acts_as_watchable
|
|
|
|
|
acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"],
|
|
|
|
@ -1359,7 +1359,7 @@ class Issue < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
# Callback on file attachment
|
|
|
|
|
def attachment_added(obj)
|
|
|
|
|
if @current_journal && !obj.new_record? && @current_journal.journalized_id == obj.author_id
|
|
|
|
|
if @current_journal && @current_journal.user_id == obj.author_id && JournalDetail.find_all_by_value(obj.filename).count == 0
|
|
|
|
|
@current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|