From df53cbd0acc631687a50cd17f59cffdb1158c2b9 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Wed, 3 Jun 2015 13:45:21 +0200 Subject: [PATCH] new timeline escaped content --- .../user-timeline-item-type.service.coffee | 9 ++++----- .../user-timeline-item.controller.coffee | 5 ++--- .../user-timeline-item.controller.spec.coffee | 2 +- .../user-timeline-item/user-timeline-item.jade | 2 +- .../user-timeline/user-timeline/user-timeline.scss | 4 ++++ 5 files changed, 12 insertions(+), 10 deletions(-) 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 d6eb3cad..528c2751 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 @@ -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) -> diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.coffee b/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.coffee index 8da84bc5..08a57487 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.coffee +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.coffee @@ -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) diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.spec.coffee b/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.spec.coffee index 1ef9b7c3..fae5ad1a 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.spec.coffee +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item.controller.spec.coffee @@ -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) diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade b/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade index c51e721b..e1090254 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade @@ -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 diff --git a/app/modules/user-timeline/user-timeline/user-timeline.scss b/app/modules/user-timeline/user-timeline/user-timeline.scss index d6b2372e..8a819a6f 100644 --- a/app/modules/user-timeline/user-timeline/user-timeline.scss +++ b/app/modules/user-timeline/user-timeline/user-timeline.scss @@ -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;