Only fetch labels for uploaded docs, not files

This commit is contained in:
Shane Kilkelly 2017-06-08 15:55:17 +01:00
parent ff7955dfdb
commit 965a46291b
4 changed files with 11 additions and 6 deletions

View file

@ -96,9 +96,13 @@ module.exports = FileSystemImportManager =
FileTypeManager.isBinary name, path, (error, isBinary) =>
return callback(error) if error?
if isBinary
FileSystemImportManager.addFile user_id, project_id, folder_id, name, path, replace, callback
FileSystemImportManager.addFile user_id, project_id, folder_id, name, path, replace, (err, entity) ->
entity?.type = 'file'
callback(err, entity)
else
FileSystemImportManager.addDoc user_id, project_id, folder_id, name, path, replace, callback
FileSystemImportManager.addDoc user_id, project_id, folder_id, name, path, replace, (err, entity) ->
entity?.type = 'doc'
callback(err, entity)
_isSafeOnFileSystem: (path, callback = (err, isSafe)->)->

View file

@ -50,5 +50,5 @@ module.exports = ProjectUploadController =
logger.log
project_id: project_id, file_path: path, file_name: name, folder_id: folder_id
"uploaded file"
res.send success: true, entity_id: entity?._id
res.send success: true, entity_id: entity?._id, entity_type: entity?.type

View file

@ -31,8 +31,9 @@ define [
if entity.type == 'doc'
delete @state.documents[entity.id]
@$scope.$on 'file:upload:complete', (e, entityId) =>
@loadDocLabelsFromServer(entityId)
@$scope.$on 'file:upload:complete', (e, upload) =>
if upload.entity_type == 'doc'
@loadDocLabelsFromServer(upload.entity_id)
onChange = (change) =>
if change.remote

View file

@ -135,7 +135,7 @@ define [
$timeout (() ->
uploadCount--
if response.success
$rootScope.$broadcast 'file:upload:complete', response.entity_id
$rootScope.$broadcast 'file:upload:complete', response
if uploadCount == 0 and response? and response.success
$modalInstance.close("done")
), 250