Merge pull request #550 from taigaio/issue/2919/add-new-item-value-in-timeline
add the new field value in the the timelinestable
commit
fe72d62c46
|
@ -1239,9 +1239,13 @@
|
||||||
"NEW_PROJECT": "{{username}} created the project {{project_name}}",
|
"NEW_PROJECT": "{{username}} created the project {{project_name}}",
|
||||||
"MILESTONE_UPDATED": "{{username}} has updated the sprint {{obj_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": "{{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}}",
|
"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": "{{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}}",
|
"WIKI_UPDATED": "{{username}} has updated the wiki page {{obj_name}}",
|
||||||
"NEW_COMMENT_US": "{{username}} has commented in the US {{obj_name}}",
|
"NEW_COMMENT_US": "{{username}} has commented in the US {{obj_name}}",
|
||||||
"NEW_COMMENT_ISSUE": "{{username}} has commented in the issue {{obj_name}}",
|
"NEW_COMMENT_ISSUE": "{{username}} has commented in the issue {{obj_name}}",
|
||||||
|
|
|
@ -38,6 +38,11 @@ class UserTimelineItemTitle
|
||||||
|
|
||||||
return @._getLink(url, timeline.data.project.name)
|
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'
|
else if param == 'sprint_name'
|
||||||
url = 'project-taskboard:project=vm.activity.project.slug,sprint=vm.activity.sprint.slug'
|
url = 'project-taskboard:project=vm.activity.project.slug,sprint=vm.activity.sprint.slug'
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,30 @@ describe "tgUserTimelineItemTitle", ->
|
||||||
|
|
||||||
expect(title).to.be.equal("title_ok")
|
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", () ->
|
it "title with project name", () ->
|
||||||
timeline = {
|
timeline = {
|
||||||
data: {
|
data: {
|
||||||
|
@ -277,3 +301,37 @@ describe "tgUserTimelineItemTitle", ->
|
||||||
title = mySvc.getTitle(timeline, event, type)
|
title = mySvc.getTitle(timeline, event, type)
|
||||||
|
|
||||||
expect(title).to.be.equal("title_ok")
|
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")
|
||||||
|
|
|
@ -140,25 +140,69 @@ timelineType = (timeline, event) ->
|
||||||
},
|
},
|
||||||
{ # UsUpdated
|
{ # UsUpdated
|
||||||
check: (timeline, event) ->
|
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',
|
key: 'TIMELINE.US_UPDATED',
|
||||||
translate_params: ['username', 'field_name', 'obj_name']
|
translate_params: ['username', 'field_name', 'obj_name']
|
||||||
},
|
},
|
||||||
{ # IssueUpdated
|
{ # IssueUpdated
|
||||||
check: (timeline, event) ->
|
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',
|
key: 'TIMELINE.ISSUE_UPDATED',
|
||||||
translate_params: ['username', 'field_name', 'obj_name']
|
translate_params: ['username', 'field_name', 'obj_name']
|
||||||
},
|
},
|
||||||
{ # TaskUpdated
|
{ # TaskUpdated
|
||||||
check: (timeline, event) ->
|
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',
|
key: 'TIMELINE.TASK_UPDATED',
|
||||||
translate_params: ['username', 'field_name', 'obj_name']
|
translate_params: ['username', 'field_name', 'obj_name']
|
||||||
},
|
},
|
||||||
{ # TaskUpdated with US
|
{ # TaskUpdated with US
|
||||||
check: (timeline, event) ->
|
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',
|
key: 'TIMELINE.TASK_UPDATED_WITH_US',
|
||||||
translate_params: ['username', 'field_name', 'obj_name', 'us_name']
|
translate_params: ['username', 'field_name', 'obj_name', 'us_name']
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue