Created
May 30, 2016 07:01
-
-
Save Darep/b33ba3d71f4570760422317aa7bf31f2 to your computer and use it in GitHub Desktop.
Remove all comments from GitHub Pull Request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sometimes it's necessary to do a bit of clean-up | |
Array.prototype.forEach.call(document.querySelectorAll('.js-comment-delete button'), function(el, i) { | |
el.removeAttribute('data-confirm'); | |
el.click(); | |
}); |
Any luck on getting it to just hide the comments instead of deleting them?
Still working, perfect. Thanks
This still works! We had a service user that logged a lot of spam comments on a PR, so I used this code to remove only those comments:
var comment_headers = document.querySelectorAll('.timeline-comment');
for (var i = 0; i < comment_headers.length; i++) {
var button = comment_headers[i].querySelector('.js-comment-delete button');
if (button) {
if (comment_headers[i].querySelector('.author').text == '<service-account-name>') {
button.removeAttribute('data-confirm');
button.click();
}
}
}
Still works. If you have many comments that are folded, you'll need to expand them first.
Still works. Thanks.
Still works. Thanks.
I wanted to resolve ~100 comments and was able to use this:
Array.prototype.forEach.call(document.querySelectorAll('.js-resolvable-timeline-thread-form button'), function(el, i) {
el.click()
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Still working. Thanks.