 processedFiles.observeChanges
   removed: (id) ->
     delete importingFiles[id]
+
+# Observes enqueued files that get canceled
+canceledFiles = ImportingFile.documents.find
+  canceled: true
+  enqueued: true
+  finished: false
+  errored: false
+canceledFiles.observe
+  added: (id) ->
+    ImportingFile.documents.update id,
+      $set:
+        finished: true
+        status: "Import canceled"
 
 verifyFile = (file, publicationId, samples) ->
   ImportingFile.documents.update file._id,

      sha256: 1
  return unless document

  Meteor.call 'create-publication', document.name, document.sha256, (error, result) ->
    if error
      ImportingFile.documents.update document._id,

    sha256:
      $exists: false
    errored: false
    finished: false
  ,
    fields:
      _id: 1
