Patch #11499 ยป 0017-Fixed-attachments-handling-when-receiving-a-new-issu.patch
| app/models/issue.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
# Callback on attachment deletion
|
||
|
# Callback on attachment addition
|
||
|
def attachment_added(obj)
|
||
|
if @current_journal && !obj.new_record?
|
||
|
@current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)
|
||
|
end
|
||
|
init_journal(User.current) unless @current_journal
|
||
|
@current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)
|
||
|
# Currently, this is only triggered from attachments#destroy, so
|
||
|
# there's no one else to save the issue's journal.
|
||
|
@current_journal.save
|
||
|
end
|
||
|
# Callback on attachment deletion
|
||
| app/models/mail_handler.rb | ||
|---|---|---|
|
add_watchers(issue)
|
||
|
issue.save!
|
||
|
add_attachments(issue)
|
||
|
if add_attachments(issue)
|
||
|
# Adding attachments to a new issue creates a journal. We need
|
||
|
# to save the record to trigger an issue update mail.
|
||
|
issue.save!
|
||
|
end
|
||
|
logger.info "MailHandler: issue ##{issue.id} created by #{user}"
|
||
|
issue
|
||
|
end
|
||