From 8b2ac40c42993e1cb8e30d5a50f42c1a3fbcb590 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Wed, 29 Jul 2015 11:39:08 +0200 Subject: [PATCH] fix timeline attachments --- .../user-timeline-item/user-timeline-item.controller.coffee | 5 +++-- .../user-timeline-item.controller.spec.coffee | 3 ++- .../user-timeline/user-timeline-item/user-timeline-item.jade | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.coffee b/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.coffee index 9228cf37..f73b1545 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.coffee +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.coffee @@ -20,8 +20,9 @@ class UserTimelineItemController if type.member @.timeline = @.timeline.set('member', type.member(@.timeline)) - if @.timeline.hasIn(['data', 'value_diff', 'attachments', 'new']) - @.timeline = @.timeline.set('attachments', @.timeline.getIn(['data', 'value_diff', 'attachments', 'new'])) + if @.timeline.getIn(['data', 'value_diff', 'key']) == 'attachments' && + @.timeline.hasIn(['data', 'value_diff', 'value', 'new']) + @.timeline = @.timeline.set('attachments', @.timeline.getIn(['data', 'value_diff', 'value', 'new'])) getObject: (timeline, event) -> if timeline.get('data').get(event.obj) diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.spec.coffee b/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.spec.coffee index 28a3f15d..bbad8f5b 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.spec.coffee +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.spec.coffee @@ -54,7 +54,8 @@ describe "UserTimelineItemController", -> id: 2 }, value_diff: { - attachments: { + key: 'attachments', + value: { new: "fakeAttachment" } } diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade b/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade index 6ed8f7f9..f549c8a2 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade @@ -25,5 +25,5 @@ div.activity-item span {{::vm.timeline.getIn(['member','user', 'name'])}} p {{::vm.timeline.getIn(['member','role', 'name'])}} - div(ng-repeat="attachment in vm.timeline.get('attachments')") + div(tg-repeat="attachment in vm.timeline.get('attachments')") div(tg-user-timeline-attachment="attachment")