DeleteAttachments deletes the given attachments and optionally the associated files.
(attachments []*Attachment, remove bool)
| 164 | |
| 165 | // DeleteAttachments deletes the given attachments and optionally the associated files. |
| 166 | func DeleteAttachments(attachments []*Attachment, remove bool) (int, error) { |
| 167 | for i, a := range attachments { |
| 168 | if remove { |
| 169 | if err := os.Remove(a.LocalPath()); err != nil { |
| 170 | return i, err |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | if _, err := x.Delete(a); err != nil { |
| 175 | return i, err |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | return len(attachments), nil |
| 180 | } |
| 181 | |
| 182 | // DeleteAttachmentsByIssue deletes all attachments associated with the given issue. |
| 183 | func DeleteAttachmentsByIssue(issueID int64, remove bool) (int, error) { |
no test coverage detected