new timeline escaped content

stable
Juanfran 2015-06-03 13:45:21 +02:00
parent d27f612bb8
commit df53cbd0ac
5 changed files with 12 additions and 10 deletions

View File

@ -61,7 +61,7 @@ timelineType = (timeline, event) ->
key: 'TIMELINE.NEW_COMMENT_US',
translate_params: ['username', 'obj_name'],
description: (timeline) ->
return taiga.stripTags(timeline.data.comment_html, 'br|p')
return timeline.data.comment
},
{ # NewIssueComment
check: (timeline, event) ->
@ -69,8 +69,7 @@ timelineType = (timeline, event) ->
key: 'TIMELINE.NEW_COMMENT_ISSUE',
translate_params: ['username', 'obj_name'],
description: (timeline) ->
text = taiga.replaceTags(timeline.data.comment_html, 'h1|h2|h3', 'p')
return taiga.stripTags(text, 'br|p')
return timeline.data.comment
},
{ # NewTask
check: (timeline, event) ->
@ -78,7 +77,7 @@ timelineType = (timeline, event) ->
key: 'TIMELINE.NEW_COMMENT_TASK'
translate_params: ['username', 'obj_name'],
description: (timeline) ->
return taiga.stripTags(timeline.data.comment_html, 'br|p')
return timeline.data.comment
},
{ # UsToMilestone
check: (timeline, event, field_name) ->
@ -107,7 +106,7 @@ timelineType = (timeline, event) ->
key: 'TIMELINE.BLOCKED',
translate_params: ['username', 'obj_name'],
description: (timeline) ->
return taiga.stripTags(timeline.data.values_diff.blocked_note_html[1], 'br')
return $(timeline.data.values_diff.blocked_note_html[1]).text()
},
{ # UnBlocked
check: (timeline, event) ->

View File

@ -1,11 +1,10 @@
class UserTimelineItemController
@.$inject = [
"$sce",
"tgUserTimelineItemType",
"tgUserTimelineItemTitle"
]
constructor: (@sce, @userTimelineItemType, @userTimelineItemTitle) ->
constructor: (@userTimelineItemType, @userTimelineItemTitle) ->
timeline = @.timeline.toJS()
event = @.parseEventType(timeline.event_type)
type = @userTimelineItemType.getType(timeline, event)
@ -20,7 +19,7 @@ class UserTimelineItemController
@.activity.obj = @.getObject(timeline, event)
if type.description
@.activity.description = @sce.trustAsHtml(type.description(timeline))
@.activity.description = type.description(timeline)
if type.member
@.activity.member = type.member(timeline)

View File

@ -99,6 +99,6 @@ describe "UserTimelineItemController", ->
myCtrl = controller("UserTimelineItem", {$scope: scope}, {timeline: timeline_immutable})
expect(myCtrl.activity.description).to.be.an('object') # $sce.trustAsHtml
expect(myCtrl.activity.description).to.be.equal(description)
expect(myCtrl.activity.member).to.be.equal(member)
expect(myCtrl.activity.attachments).to.be.equal(attachment)

View File

@ -8,7 +8,7 @@ div.activity-item
p(tg-compile-html="vm.activity.title")
blockquote.activity-comment-quote(ng-if="::vm.activity.description")
p(ng-bind-html="vm.activity.description")
| {{::vm.activity.description | limitTo:300}}
.activity-member-view(ng-if="::vm.activity.member")
.profile-member-picture

View File

@ -18,9 +18,13 @@
}
}
blockquote {
line-height: 2em;
margin-bottom: 0;
margin-left: calc(35px + 1rem);
margin-top: .5rem;
overflow-x: auto;
overflow-y: hidden;
white-space: pre-line;
}
img {
max-height: 640px;