Refined-github: Add functionality to expand all outdated comments at once

Created on 29 Oct 2017  Â·  10Comments  Â·  Source: sindresorhus/refined-github

Hey everyone, first comment in this repo, so wanted to give you a big "Thank You" first for creating this great extension!

What do you think of the following small tweak for pull requests:

  • when hovering over the "Show outdated" text, a small popup tells you "Hold shift while clicking to expand all comments"
  • when shift-clicking on the "Show outdated" text, all collapsed comments expand

image

Alternative implementation ideas:

  • Have a button/text next to "Show outdated"
  • Use a different button combination

Why? My team is currently in the habit of manually going through all outdated comments to make sure they were implemented correctly. Sometimes those comments are outdated because of code formatting or similar. We are currently using JS via a bookmark to achieve that functionality, but it would be really nice to have this in this extension.

Very happy to try implementing this myself, but I wanted to check if this is something you might be interested in.

enhancement

Most helpful comment

JS bookmark for recent Github redesign:
javascript:Array.from(document.getElementsByClassName('outdated-comment')).forEach(l => l.setAttribute('open',true));

All 10 comments

I find myself doing this often too. I feel that we should tackle this and other similar toggles via keyboard shortcut, eg cmd+click=toggle all. No UI clutter necessary.

Alternatively it could be alt+click to match macOS’ alternative behavior, and perhaps we could show the alternative actions while alt is held down i.e. all Show outdated become Show all outdated (macOS does the same)

212 is related. Maybe pressing i also works in the discussione tab? I’m away from keyboard now

I didn't find anything and I think that Github doesn't provide that feature

Here's a screenshot of the shortcuts displayed for the discussion page

image

JS bookmark for recent Github redesign:
javascript:Array.from(document.getElementsByClassName('outdated-comment')).forEach(l => l.setAttribute('open',true));

@laurenbrandstein thank you!

To add to @laurenbrandstein solution, this worked for me
javascript:Array.from(document.getElementsByClassName('outdated-comment')).forEach(l=>l.setAttribute('class','file js-comment-container has-inline-notes'));

@mgoveas I think the entire conversation needs to be unhidden and I have a few PRs where I have to meticulously scroll around to find these "hidden items" and click a few times and it is a pain.

2020 edition.

Open all resolved:

javascript:Array.from(document.getElementsByClassName("js-toggle-outdated-comments")).forEach(l => l.click());

Click all "Load More":

javascript:Array.from(document.getElementsByClassName("ajax-pagination-btn")).forEach(l => l.click());

thanks @voppe that worked!

The solution for "Load More" is too simplistic that only works for one level (I have PRs that nest at least 10 levels), so here is my better solution: https://stackoverflow.com/a/62711702/95750

There are other solutions that I found later:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olso picture olso  Â·  3Comments

mareksuscak picture mareksuscak  Â·  3Comments

MilesBHuff picture MilesBHuff  Â·  3Comments

sindresorhus picture sindresorhus  Â·  3Comments

alexanderadam picture alexanderadam  Â·  3Comments