From 1a64e7d74e7e8eedcf1bdc834700d87fb57e98d4 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Mon, 1 Jun 2015 10:15:22 +0200 Subject: [PATCH] Issue 2748 - add us reference in task timeline --- app/locales/locale-en.json | 1 + .../user-timeline-item-title.service.coffee | 11 +++++++++++ .../user-timeline-item-type.service.coffee | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/locales/locale-en.json b/app/locales/locale-en.json index 93639da1..d90335a4 100644 --- a/app/locales/locale-en.json +++ b/app/locales/locale-en.json @@ -1171,6 +1171,7 @@ "US_UPDATED": "{{username}} has updated the attribute \"{{field_name}}\" of the US {{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}}", + "TASK_UPDATED_WITH_US": "{{username}} has updated the attribute \"{{field_name}}\" of the Task {{obj_name}} which belongs to the US {{us_name}}", "WIKI_UPDATED": "{{username}} has update 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}}", diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item-title.service.coffee b/app/modules/user-timeline/user-timeline-item/user-timeline-item-title.service.coffee index e7a7da9b..491ce971 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item-title.service.coffee +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item-title.service.coffee @@ -41,6 +41,16 @@ class UserTimelineItemTitle return @._getLink(url, timeline.data.milestone.name) + else if param == 'us_name' + obj = @._getTimelineObj(timeline, event).userstory + + event_us = {obj: 'parent_userstory'} + url = @._getDetailObjUrl(event_us) + + text = '#' + obj.ref + ' ' + obj.subject + + return @._getLink(url, text) + else if param == 'obj_name' obj = @._getTimelineObj(timeline, event) url = @._getDetailObjUrl(event) @@ -63,6 +73,7 @@ class UserTimelineItemTitle "wikipage": ["project-wiki-page", ":project=vm.activity.project.slug,slug=vm.activity.obj.slug"], "task": ["project-tasks-detail", ":project=vm.activity.project.slug,ref=vm.activity.obj.ref"], "userstory": ["project-userstories-detail", ":project=vm.activity.project.slug,ref=vm.activity.obj.ref"], + "parent_userstory": ["project-userstories-detail", ":project=vm.activity.project.slug,ref=vm.activity.obj.userstory.ref"], "milestone": ["project-taskboard", ":project=vm.activity.project.slug,sprint=vm.activity.obj.slug"] } diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item-type.service.coffee b/app/modules/user-timeline/user-timeline-item/user-timeline-item-type.service.coffee index 6e15edbf..d6eb3cad 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item-type.service.coffee +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item-type.service.coffee @@ -144,9 +144,15 @@ timelineType = (timeline, event) -> }, { # TaskUpdated check: (timeline, event) -> - return event.obj == 'task' && event.type == 'change' + return event.obj == 'task' && event.type == 'change' && !timeline.data.task.userstory 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 + key: 'TIMELINE.TASK_UPDATED_WITH_US', + translate_params: ['username', 'field_name', 'obj_name', 'us_name'] } ]