Skip to content

Commit 31e8e0c

Browse files
author
Mike Taylor
authored
Merge pull request #2410 from /issues/2408
Fixes #2408 - Allow additional safe HTML tags in sanitized markdown
2 parents 2ee5c62 + beff4ab commit 31e8e0c

File tree

7 files changed

+267
-232
lines changed

7 files changed

+267
-232
lines changed

.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"md": true,
2626
"module": true,
2727
"moment": true,
28+
"MarkdownSanitizerMixin": true,
2829
"Mousetrap": true,
2930
"PaginationMixin": true,
3031
"Prism": true,

grunt-tasks/concat.js

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module.exports = function(grunt) {
3737
},
3838
issues: {
3939
src: [
40+
"<%= jsPath %>/lib/mixins/extend-md-sanitizer.js",
4041
"<%= jsPath %>/lib/models/label-list.js",
4142
"<%= jsPath %>/lib/editor.js",
4243
"<%= jsPath %>/lib/labels.js",
@@ -54,6 +55,7 @@ module.exports = function(grunt) {
5455
"<%= jsPath %>/lib/models/label-list.js",
5556
"<%= jsPath %>/lib/models/issue.js",
5657
"<%= jsPath %>/lib/mixins/pagination.js",
58+
"<%= jsPath %>/lib/mixins/extend-md-sanitizer.js",
5759
"<%= jsPath %>/lib/issue-list.js"
5860
],
5961
dest: "<%= jsDistPath %>/issue-list.js"

webcompat/static/js/lib/comments.js

+17-11
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@ issues.CommentsCollection = Backbone.Collection.extend({
2121
}
2222
});
2323

24-
issues.CommentView = Backbone.View.extend({
25-
className: "issue-comment js-Issue-comment grid-cell x2",
26-
id: function() {
27-
return this.model.get("commentLinkId");
28-
},
29-
template: wcTmpl["issue/issue-comment-list.jst"],
30-
render: function() {
31-
this.$el.html(this.template(this.model.toJSON()));
32-
return this;
33-
}
34-
});
24+
var commentMarkdownSanitizer = new MarkdownSanitizerMixin();
25+
26+
issues.CommentView = Backbone.View.extend(
27+
_.extend({}, commentMarkdownSanitizer, {
28+
className: "issue-comment js-Issue-comment grid-cell x2",
29+
id: function() {
30+
return this.model.get("commentLinkId");
31+
},
32+
template: wcTmpl["issue/issue-comment-list.jst"],
33+
render: function() {
34+
var modelData = this.model.toJSON();
35+
modelData.body = this.sanitizeMarkdown(modelData.body);
36+
this.$el.html(this.template(modelData));
37+
return this;
38+
}
39+
})
40+
);

0 commit comments

Comments
 (0)