add the new field value in the the timeline

stable
Juanfran 2015-06-24 12:17:44 +02:00 committed by Alejandro Alonso
parent 0d93812918
commit a750376055
4 changed files with 116 additions and 5 deletions

View File

@ -1239,9 +1239,13 @@
"NEW_PROJECT": "{{username}} created the project {{project_name}}",
"MILESTONE_UPDATED": "{{username}} has updated the sprint {{obj_name}}",
"US_UPDATED": "{{username}} has updated the attribute \"{{field_name}}\" of the US {{obj_name}}",
"US_UPDATED_WITH_NEW_VALUE": "{{username}} has updated the attribute \"{{field_name}}\" of the US {{obj_name}} to {{new_value}}",
"ISSUE_UPDATED": "{{username}} has updated the attribute \"{{field_name}}\" of the issue {{obj_name}}",
"TASK_UPDATED": "{{username}} has updated the attribute \"{{field_name}}\" of the task {{obj_name}}",
"ISSUE_UPDATED_WITH_NEW_VALUE": "{{username}} has updated the attribute \"{{field_name}}\" of the issue {{obj_name}} to {{new_value}}",
"TASK_UPDATED": "{{username}} has updated the attribute \"{{field_name}}\" of the task {{obj_name}} to {{new_value}}",
"TASK_UPDATED_WITH_NEW_VALUE": "{{username}} has updated the attribute \"{{field_name}}\" of the task {{obj_name}} to {{new_value}}",
"TASK_UPDATED_WITH_US": "{{username}} has updated the attribute \"{{field_name}}\" of the task {{obj_name}} which belongs to the US {{us_name}}",
"TASK_UPDATED_WITH_US_NEW_VALUE": "{{username}} has updated the attribute \"{{field_name}}\" of the task {{obj_name}} which belongs to the US {{us_name}} to {{new_value}}",
"WIKI_UPDATED": "{{username}} has updated the wiki page {{obj_name}}",
"NEW_COMMENT_US": "{{username}} has commented in the US {{obj_name}}",
"NEW_COMMENT_ISSUE": "{{username}} has commented in the issue {{obj_name}}",

View File

@ -38,6 +38,11 @@ class UserTimelineItemTitle
return @._getLink(url, timeline.data.project.name)
else if param == 'new_value'
field_name = Object.keys(timeline.data.values_diff)[0]
return timeline.data.values_diff[field_name][1]
else if param == 'sprint_name'
url = 'project-taskboard:project=vm.activity.project.slug,sprint=vm.activity.sprint.slug'

View File

@ -97,6 +97,30 @@ describe "tgUserTimelineItemTitle", ->
expect(title).to.be.equal("title_ok")
it "title with new value", () ->
timeline = {
data: {
values_diff: {
status: ['old', 'new']
}
}
}
event = {}
type = {
key: 'NEW_VALUE',
translate_params: ['new_value']
}
mockTranslate.instant
.withArgs('NEW_VALUE', {new_value: 'new'})
.returns('new_value_ok')
title = mySvc.getTitle(timeline, event, type)
expect(title).to.be.equal("new_value_ok")
it "title with project name", () ->
timeline = {
data: {
@ -277,3 +301,37 @@ describe "tgUserTimelineItemTitle", ->
title = mySvc.getTitle(timeline, event, type)
expect(title).to.be.equal("title_ok")
it "task title with us_name", () ->
timeline = {
data: {
task: {
name: 'task_name',
userstory: {
ref: 2
subject: 'subject'
}
}
}
}
event = {
obj: 'task',
}
type = {
key: 'TITLE_OBJ',
translate_params: ['us_name']
}
objparam = sinon.match ((value) ->
return value.us_name == '<a tg-nav="project-userstories-detail:project=vm.activity.project.slug,ref=vm.activity.obj.userstory.ref" title="#2 subject">#2 subject</a>'
), "objparam"
mockTranslate.instant
.withArgs('TITLE_OBJ', objparam)
.returns('title_ok')
title = mySvc.getTitle(timeline, event, type)
expect(title).to.be.equal("title_ok")

View File

@ -140,25 +140,69 @@ timelineType = (timeline, event) ->
},
{ # UsUpdated
check: (timeline, event) ->
return event.obj == 'userstory' && event.type == 'change'
return event.obj == 'userstory' &&
event.type == 'change' &&
!timeline.data.values_diff.description_diff
key: 'TIMELINE.US_UPDATED_WITH_NEW_VALUE',
translate_params: ['username', 'field_name', 'obj_name', 'new_value']
},
{ # UsUpdated description
check: (timeline, event) ->
return event.obj == 'userstory' &&
event.type == 'change' &&
timeline.data.values_diff.description_diff
key: 'TIMELINE.US_UPDATED',
translate_params: ['username', 'field_name', 'obj_name']
},
{ # IssueUpdated
check: (timeline, event) ->
return event.obj == 'issue' && event.type == 'change'
return event.obj == 'issue' &&
event.type == 'change' &&
!timeline.data.values_diff.description_diff
key: 'TIMELINE.ISSUE_UPDATED_WITH_NEW_VALUE',
translate_params: ['username', 'field_name', 'obj_name', 'new_value']
},
{ # IssueUpdated description
check: (timeline, event) ->
return event.obj == 'issue' &&
event.type == 'change' &&
timeline.data.values_diff.description_diff
key: 'TIMELINE.ISSUE_UPDATED',
translate_params: ['username', 'field_name', 'obj_name']
},
{ # TaskUpdated
check: (timeline, event) ->
return event.obj == 'task' && event.type == 'change' && !timeline.data.task.userstory
return event.obj == 'task' &&
event.type == 'change' &&
!timeline.data.task.userstory &&
!timeline.data.values_diff.description_diff
key: 'TIMELINE.TASK_UPDATED_WITH_NEW_VALUE',
translate_params: ['username', 'field_name', 'obj_name', 'new_value']
},
{ # TaskUpdated description
check: (timeline, event) ->
return event.obj == 'task' &&
event.type == 'change' &&
!timeline.data.task.userstory &&
timeline.data.values_diff.description_diff
key: 'TIMELINE.TASK_UPDATED',
translate_params: ['username', 'field_name', 'obj_name']
},
{ # TaskUpdated with US
check: (timeline, event) ->
return event.obj == 'task' && event.type == 'change' && timeline.data.task.userstory
return event.obj == 'task' &&
event.type == 'change' &&
timeline.data.task.userstory &&
!timeline.data.values_diff.description_diff
key: 'TIMELINE.TASK_UPDATED_WITH_US_NEW_VALUE',
translate_params: ['username', 'field_name', 'obj_name', 'us_name', 'new_value']
},
{ # TaskUpdated with US description
check: (timeline, event) ->
return event.obj == 'task' &&
event.type == 'change' &&
timeline.data.task.userstory &&
timeline.data.values_diff.description_diff
key: 'TIMELINE.TASK_UPDATED_WITH_US',
translate_params: ['username', 'field_name', 'obj_name', 'us_name']
},