Last active
June 5, 2024 12:32
-
-
Save huyby/ff5d84fca7cdfdd5a85bb0576985f390 to your computer and use it in GitHub Desktop.
Github subscription clean up
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
function unsubscribeAll() { | |
fetch('https://github.com/notifications/subscriptions?reason=review_requested', { | |
method: 'POST', | |
body:new FormData(document.querySelector('#threads-unsubscribe-form')), | |
}) | |
.then((response) => response.text()) | |
.then((text) => { | |
document.querySelector('html').innerHTML=text | |
const subscriptionIds = document.querySelectorAll('input[name^=subscription_ids]'); | |
if (subscriptionIds.length === 25) { | |
document.querySelectorAll('input[name^=subscription_ids]').forEach((el) => el.checked=true); | |
setTimeout(unsubscribeAll, 1000); | |
} | |
}) | |
} |
Added ?reason=review_requested
to only cleanup those subscriptions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Head to https://github.com/notifications/subscriptions and run function through console. It stops when page has less than 25 subscriptions on the page, some kind of "safety" to stop on time.