fix attachments unit tests

stable
Juanfran 2016-01-22 14:13:11 +01:00
parent b5e61863c7
commit 3943d4037e
2 changed files with 8 additions and 1 deletions

View File

@ -43,6 +43,8 @@ class AttachmentController
save: () -> save: () ->
attachment = @.attachment.set('loading', true) attachment = @.attachment.set('loading', true)
@.onUpdate({attachment: attachment})
attachment = @.attachment.merge({ attachment = @.attachment.merge({
editable: false, editable: false,
loading: false loading: false

View File

@ -123,9 +123,14 @@ class AttachmentsFullService extends taiga.Service
patch = taiga.patch(oldAttachment.get('file'), toUpdateAttachment.get('file')) patch = taiga.patch(oldAttachment.get('file'), toUpdateAttachment.get('file'))
return @attachmentsService.patch(toUpdateAttachment.getIn(['file', 'id']), type, patch).then () => if toUpdateAttachment.get('loading')
@._attachments = @._attachments.set(index, toUpdateAttachment) @._attachments = @._attachments.set(index, toUpdateAttachment)
@.regenerate() @.regenerate()
else
return @attachmentsService.patch(toUpdateAttachment.getIn(['file', 'id']), type, patch).then () =>
@._attachments = @._attachments.set(index, toUpdateAttachment)
@.regenerate()
angular.module("taigaComponents").service("tgAttachmentsFullService", AttachmentsFullService) angular.module("taigaComponents").service("tgAttachmentsFullService", AttachmentsFullService)