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