Automagically un-collapse Jira comments
Ben Sinclair
Posted on May 12, 2021
If you use Jira, you probably know that you can order ticket comments either wrongly (reverse-chronological, like Twitter) or rightly (the way humans read English).
The default setting is "wrongly1"
If you fix it, then you're left with a different problem. You see, you, as a user, want to be able to read the comments in the correct order, but you're also most likely to be interested in the latest one. Only Atlassian have decided you shouldn't be allowed to read it until a period of several time-units has passed, in which you've scrolled down and clicked "View x newer comments" a gazillion times2.
So a made an exceptionally dumb Chrom(e|ium) extension to fix it, which periodically mashes the button on your behalf.
const swonk = function() {
const buttonNodes = document.querySelectorAll('[data-test-id="issue.views.issue-details.issue-layout.left-most-column"] button');
const buttonElements = [...buttonNodes].filter(e => e.innerText.match(/^View\s+\d+\s+remaining\snewer\scomments$/));
buttonElements.forEach(e => e.click());
}
setInterval(swonk, 100);
Why don't I use a MutationObserver
you ask? Well, it's because in longer than the two minutes it took to type that out, I couldn't find anything useful to observe, since Jira's HTML is complete div soup.
If you are lazy, like me, you can grab this. I put it on GitHub for a change: moopet/jira-comment-uncollapser
Posted on May 12, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
October 1, 2024
July 16, 2024