Not showing empty entries in timelines or activity tabs

stable
Alejandro Alonso 2015-11-05 13:54:46 +01:00 committed by David Barragán Merino
parent 259b3278e3
commit c65ddc1d54
2 changed files with 17 additions and 6 deletions

View File

@ -29,9 +29,12 @@ module = angular.module("taigaCommon")
IGNORED_FIELDS = {
"userstories.userstory": [
"watchers", "kanban_order", "backlog_order", "sprint_order", "finish_date"
]
],
"tasks.task": [
"watchers", "us_order", "taskboard_order"
],
"issues.issue": [
"watchers"
]
}
@ -66,7 +69,13 @@ class HistoryController extends taiga.Controller
delete historyResult.values_diff.blocked_note_html
delete historyResult.values_diff.blocked_note_diff
@scope.history = history
for historyEntry in history
changeModel = historyEntry.key.split(":")[0]
if IGNORED_FIELDS[changeModel]?
historyEntry.values_diff = _.removeKeys(historyEntry.values_diff, IGNORED_FIELDS[changeModel])
@scope.history = _.filter(history, (item) -> Object.keys(item.values_diff).length > 0)
@scope.comments = _.filter(history, (item) -> item.comment != "")
deleteComment: (type, objectId, activityId) ->
@ -262,10 +271,6 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
return templateChangeGeneric({name:name, from:from, to: to})
renderChangeEntries = (change) ->
changeModel = change.key.split(":")[0]
if IGNORED_FIELDS[changeModel]?
change.values_diff = _.removeKeys(change.values_diff, IGNORED_FIELDS[changeModel])
return _.map(change.values_diff, (value, field) -> renderChangeEntry(field, value))
renderChangesHelperText = (change) ->

View File

@ -66,6 +66,12 @@ class UserTimelineService extends taiga.Service
return false
},
{# Empty change
check: (timeline) ->
event = timeline.get('event_type').split(".")
value_diff = timeline.get("data").get("value_diff")
return event[2] == 'change' and value_diff == undefined
},
{# Deleted
check: (timeline) ->
event = timeline.get('event_type').split(".")