Skip to content

Commit

Permalink
Fixes #2408 - Allow additional safe HTML tags in sanitized markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Stuff committed Apr 19, 2018
1 parent dabac53 commit beff4ab
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 232 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"md": true,
"module": true,
"moment": true,
"MarkdownSanitizerMixin": true,
"Mousetrap": true,
"PaginationMixin": true,
"Prism": true,
Expand Down
2 changes: 2 additions & 0 deletions grunt-tasks/concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = function(grunt) {
},
issues: {
src: [
"<%= jsPath %>/lib/mixins/extend-md-sanitizer.js",
"<%= jsPath %>/lib/models/label-list.js",
"<%= jsPath %>/lib/editor.js",
"<%= jsPath %>/lib/labels.js",
Expand All @@ -54,6 +55,7 @@ module.exports = function(grunt) {
"<%= jsPath %>/lib/models/label-list.js",
"<%= jsPath %>/lib/models/issue.js",
"<%= jsPath %>/lib/mixins/pagination.js",
"<%= jsPath %>/lib/mixins/extend-md-sanitizer.js",
"<%= jsPath %>/lib/issue-list.js"
],
dest: "<%= jsDistPath %>/issue-list.js"
Expand Down
28 changes: 17 additions & 11 deletions webcompat/static/js/lib/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ issues.CommentsCollection = Backbone.Collection.extend({
}
});

issues.CommentView = Backbone.View.extend({
className: "issue-comment js-Issue-comment grid-cell x2",
id: function() {
return this.model.get("commentLinkId");
},
template: wcTmpl["issue/issue-comment-list.jst"],
render: function() {
this.$el.html(this.template(this.model.toJSON()));
return this;
}
});
var commentMarkdownSanitizer = new MarkdownSanitizerMixin();

issues.CommentView = Backbone.View.extend(
_.extend({}, commentMarkdownSanitizer, {
className: "issue-comment js-Issue-comment grid-cell x2",
id: function() {
return this.model.get("commentLinkId");
},
template: wcTmpl["issue/issue-comment-list.jst"],
render: function() {
var modelData = this.model.toJSON();
modelData.body = this.sanitizeMarkdown(modelData.body);
this.$el.html(this.template(modelData));
return this;
}
})
);
Loading

0 comments on commit beff4ab

Please sign in to comment.