fix issue 3159 - fix timeline messages when move us's on backlog

stable
Juanfran 2015-08-06 13:49:12 +02:00
parent 4961f26896
commit 873ec2fbcc
5 changed files with 36 additions and 20 deletions

View File

@ -1262,6 +1262,7 @@
"NEW_COMMENT_TASK": "{{username}} has commented in the task {{obj_name}}",
"NEW_MEMBER": "{{project_name}} has a new member",
"US_ADDED_MILESTONE": "{{username}} has added the US {{obj_name}} to {{sprint_name}}",
"US_MOVED": "{{username}} has moved the US {{obj_name}}",
"US_REMOVED_FROM_MILESTONE": "{{username}} has added the US {{obj_name}} to the backlog",
"BLOCKED": "{{username}} has blocked {{obj_name}}",
"UNBLOCKED": "{{username}} has unblocked {{obj_name}}",

View File

@ -1,4 +1,4 @@
describe.only "ProjectController", ->
describe "ProjectController", ->
$controller = null
$q = null
provide = null

View File

@ -87,28 +87,35 @@ timelineType = (timeline, event) ->
description: (timeline) ->
return $(timeline.getIn(['data', 'comment_html'])).text()
},
{ # UsToMilestone
{ # UsMove
check: (timeline, event) ->
if timeline.hasIn(['data', 'value_diff']) &&
timeline.getIn(['data', 'value_diff', 'key']) == 'milestone' &&
return timeline.hasIn(['data', 'value_diff']) &&
timeline.getIn(['data', 'value_diff', 'key']) == 'moveInBacklog' &&
timeline.hasIn(['data', 'value_diff', 'value', 'backlog_order']) &&
event.type == 'change'
return timeline.getIn(['data', 'value_diff', 'value']).get(0) == null
return false
key: 'TIMELINE.US_ADDED_MILESTONE',
translate_params: ['username', 'obj_name', 'sprint_name']
key: 'TIMELINE.US_MOVED',
translate_params: ['username', 'obj_name']
},
{ # UsToBacklog
check: (timeline, event) ->
if timeline.hasIn(['data', 'value_diff']) &&
timeline.getIn(['data', 'value_diff', 'key']) == 'milestone' &&
timeline.getIn(['data', 'value_diff', 'key']) == 'moveInBacklog' &&
event.type == 'change'
return timeline.getIn(['data', 'value_diff', 'value']).get(1) == null
return timeline.getIn(['data', 'value_diff', 'value', 'milestone']).get(1) == null
return false
key: 'TIMELINE.US_REMOVED_FROM_MILESTONE',
translate_params: ['username', 'obj_name']
},
{ # UsToMilestone
check: (timeline, event) ->
return timeline.hasIn(['data', 'value_diff']) &&
timeline.getIn(['data', 'value_diff', 'key']) == 'moveInBacklog' &&
event.type == 'change'
key: 'TIMELINE.US_ADDED_MILESTONE',
translate_params: ['username', 'obj_name', 'sprint_name']
},
{ # Blocked
check: (timeline, event) ->
if timeline.hasIn(['data', 'value_diff']) &&

View File

@ -15,13 +15,15 @@ class UserTimelineService extends taiga.Service
'priority',
'type',
'attachments',
'milestone',
'is_iocaine',
'content_diff',
'name',
'estimated_finish',
'estimated_start',
'blocked'
# customs
'blocked',
'moveInBacklog',
'milestone'
]
_invalid: [
@ -78,6 +80,8 @@ class UserTimelineService extends taiga.Service
newdata = Immutable.List()
response.get('data').forEach (item) ->
event_type = item.get('event_type').split(".")
data = item.get('data')
values_diff = data.get('values_diff')
@ -86,6 +90,11 @@ class UserTimelineService extends taiga.Service
if values_diff.has('is_blocked')
values_diff = Immutable.Map({'blocked': values_diff})
if values_diff.has('milestone')
values_diff = Immutable.Map({'moveInBacklog': values_diff})
else if event_type[1] == 'milestone'
values_diff = Immutable.Map({'milestone': values_diff})
values_diff.forEach (value, key) ->
obj = Immutable.Map({
key: key,

View File

@ -74,7 +74,6 @@ describe "tgUserTimelineService", ->
event_type: "xx.tt.create",
data: {
values_diff: {
"fake2": "xx",
"milestone": "xx"
}
}
@ -157,10 +156,10 @@ describe "tgUserTimelineService", ->
mocks.userTimelinePaginationSequence.generate = (config) ->
return config.fetch().then (res) ->
expect(res.get('data').size).to.be.equal(14)
expect(res.get('data').size).to.be.equal(13)
items = config.filter(res.get('data'))
expect(items.size).to.be.equal(5)
expect(items.size).to.be.equal(6)
return true
@ -180,10 +179,10 @@ describe "tgUserTimelineService", ->
mocks.userTimelinePaginationSequence.generate = (config) ->
return config.fetch().then (res) ->
expect(res.get('data').size).to.be.equal(14)
expect(res.get('data').size).to.be.equal(13)
items = config.filter(res.get('data'))
expect(items.size).to.be.equal(5)
expect(items.size).to.be.equal(6)
return true
@ -203,10 +202,10 @@ describe "tgUserTimelineService", ->
mocks.userTimelinePaginationSequence.generate = (config) ->
return config.fetch().then (res) ->
expect(res.get('data').size).to.be.equal(14)
expect(res.get('data').size).to.be.equal(13)
items = config.filter(res.get('data'))
expect(items.size).to.be.equal(5)
expect(items.size).to.be.equal(6)
return true