Return null attachment when there is none

This commit is contained in:
Douwe Maan 2017-08-17 15:00:10 +02:00
parent 834f1b30d5
commit 3ef93db5a8
2 changed files with 2 additions and 2 deletions

View file

@ -112,7 +112,7 @@
:toggle-award-path="note.toggle_award_path"
/>
<issue-note-attachment
v-if="note.attachment.url"
v-if="note.attachment"
:attachment="note.attachment"
/>
</div>

View file

@ -53,7 +53,7 @@ class NoteEntity < API::Entities::Note
end
end
expose :attachment, using: NoteAttachmentEntity
expose :attachment, using: NoteAttachmentEntity, if: -> (note, _) { note.attachment? }
expose :delete_attachment_path, if: -> (note, _) { note.attachment? } do |note|
delete_attachment_project_note_path(note.project, note)
end