do not ask the api for attachments when nothing changes

Signed-off-by: Florian Kraft <f.kraft@finn.de>
pull/3245/head
Florian Kraft 9 years ago
parent f8bccbe536
commit acedeb9604
  1. 2
      frontend/app/services/conversion-service.js
  2. 9
      frontend/app/work_packages/directives/work-package-attachments-directive.js
  3. 2
      frontend/app/work_packages/services/work-package-attachments-service.js

@ -48,7 +48,7 @@ module.exports = function() {
if (bytes > 1000000) {
return ConversionService.megabytes(bytes) + 'MB';
}
return bytes + 'B'
return bytes + 'B';
}
};

@ -40,9 +40,12 @@ module.exports = function(
var workPackage = scope.workPackage(),
upload = function(event, workPackage) {
workPackageAttachmentsService.upload(workPackage, scope.files).then(function() {
scope.files = [];
}).finally(loadAttachments);
if (scope.files.length > 0) {
workPackageAttachmentsService.upload(workPackage, scope.files).then(function() {
scope.files = [];
loadAttachments()
});
};
},
loadAttachments = function() {
if (!editMode(attrs)) {

@ -87,7 +87,7 @@ module.exports = function(Upload, PathHelper, I18n, NotificationsService, $q, $t
removal.resolve(fileOrAttachment);
}
return removal.promise;
}
};
return {
upload: upload,

Loading…
Cancel
Save