Github - remove issues entered in error

后端 未结 3 809
忘了有多久
忘了有多久 2020-12-30 03:04

Dozens of issues have been entered into my project on github that have no place there. Some Einstein ran a script and created all these nonsensical issues through the api.

3条回答
  •  温柔的废话
    2020-12-30 04:00

    Due to legal problems I've had to delete several issues with many comments of a project. I did as follows:

    1. Deleting all comments
    2. Editing the text of the issue ("THIS ISSUE WAS DELETED AND BLOCKED")
    3. Blocking the issue

    Copy paste on browser address bar:

    javascript:(function(){ $('.delete-button.octicon.octicon-x.js-comment-delete').each(function(){ href=$(this).attr("href"); if(href!==undefined) { console.log("DELETING: "+href); $.ajax({type:"DELETE",url:href}); } }); firstCommentToedit=$('form.js-comment-update')[0]; $.ajax({ type:"POST", url:firstCommentToedit.action, data:{ _method:$(firstCommentToedit).find('input[name=_method]').val(), "issue[body]":"THIS ISSUE WAS DELETED AND BLOCKED", authenticity_token:$(firstCommentToedit).find('input[name=authenticity_token]').val() } }); lockLink=$('a[href$="/lock"]')[0]; if (lockLink!==undefined) { $.ajax({ type:"POST", url:lockLink.href, data:{_method:$(lockLink).attr("data-method")} }); } setTimeout(function(){window.location=window.location;},3000) })()
    

    Expanded:

    javascript: (function() {
        $('.delete-button.octicon.octicon-x.js-comment-delete').each(function() {
            href = $(this).attr("href");
            if (href !== undefined) {
                console.log("DELETING: " + href);
                $.ajax({
                    type: "DELETE",
                    url: href
                });
            }
        });
        firstCommentToedit = $('form.js-comment-update')[0];
        $.ajax({
            type: "POST",
            url: firstCommentToedit.action,
            data: {
                _method: $(firstCommentToedit).find('input[name=_method]').val(),
                "issue[body]": "THIS ISSUE WAS DELETED AND BLOCKED",
                authenticity_token: $(firstCommentToedit).find('input[name=authenticity_token]').val()
            }
        });
        lockLink = $('a[href$="/lock"]')[0];
        if (lockLink !== undefined) {
            $.ajax({
                type: "POST",
                url: lockLink.href,
                data: {
                    _method: $(lockLink).attr("data-method")
                }
            });
        }
        setTimeout(function() {
            window.location = window.location;
        }, 3000)
    })()

提交回复
热议问题