Skip to content

Add hidden-review-comments-indicator feature - #2320

Merged
fregante merged 23 commits into
refined-github:masterfrom
sidvishnoi:toggle-comments
Aug 15, 2019
Merged

fregante merged 23 commits into
refined-github:masterfrom
sidvishnoi:toggle-comments

Conversation

@sidvishnoi

@sidvishnoi sidvishnoi commented Aug 11, 2019 •

Copy link
Copy Markdown
  • Adds an indicator besides line number gutter to show number of review comments at that line, if any.
  • Clicking on that indicator toggles hide/show all review comments in PR.
comments hidden comments visible
image image

Closes #1999

Test

https://github.com/sidvishnoi/refined-github/pull/1/files


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@fregante

Copy link
Copy Markdown
Member

Thank you for your PR, @sidvishnoi :)
I hope you can make these changes, the resulting code will be much shorter and more efficient

@sidvishnoi

Copy link
Copy Markdown
Author

Thanks for reviewing. Will continue with rest tomorrow. It's late night here.

@sidvishnoi

sidvishnoi commented Aug 12, 2019 •

Copy link
Copy Markdown
Author

@fregante Notable changes since yesterday:

  1. Using observeEl to observe each file for removal of .show-inline-notes, to add new indicators on that file, if needed.
  2. Removed countListener. Counts will get outdated if comments are added or removed. This also means, if comment count reaches 0 at some indicator, that indicator won't be removed until refresh.
  3. The feature will now also run on features.isPRCommit
  4. Use onPrFileLoad. There is room for improvement here, we need to find a selector that indicates this which new file/fragment was added, so that we don't try adding to all comments. Didn't have any success with event in onPrFileLoad(event => {}).

@fregante fregante self-assigned this Aug 12, 2019
@fregante fregante removed their assignment Aug 12, 2019
}

.show-inline-notes .rgh-comments-indicator {
display: none;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will remove the ability to toggle comment through indicators. I don't think we should do that. The original feature request also suggested so:

It'd also be useful to be able to expand/collapse comments on those placeholders.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that part, I was working on the assumption that they only appear when the comments are hidden.

The idea isn't bad, but I think it makes the UI more busy.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps making the underline a bit lighter will improve the UI.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert cd5abfc?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fregante We may want to resolve this first?

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature works well, but currently conflicts with https://github.com/OctoLinker/OctoLinker

OctoLinker seems to add a overflow-x property which causes the icon to be clipped off:

This should be resolved by overriding the overflow and/or opening an issue on OctoLinker to drop it, if not necessary

Comment thread source/content.ts Resolved
@sidvishnoi

Copy link
Copy Markdown
Author

OctoLinker seems to add a overflow-x property which causes the icon to be clipped off:

It's not OctoLinker that's adding the overflow-x. And it's working fine with that overflow actually. The image shows overflow-x being added without Octolinker.
image

But OctoLinker is definitely clashing somewhere else. Will update if I find out something.

@fregante

Copy link
Copy Markdown
Member

It's not OctoLinker that's adding the overflow-x.

Indeed. I found the culprit:

https://github.com/OctoLinker/OctoLinker/blob/0174f49ed52e936dadcacc81f8cdf428d86bc950/packages/helper-insert-link/style.css#L45-L47

overflow-x is not a problem until all children become relative to that exact element.

@sidvishnoi

Copy link
Copy Markdown
Author

The .highlight in Octolinker seems more purposeful than the overflow-x here. Removing either doesn't cause an visible issue on PR files pages (at least I didn't find any)
What do you recommend?

@fregante

fregante commented Aug 12, 2019 •

Copy link
Copy Markdown
Member

What do you recommend?

I think removing either could cause issues and conflicts. The best solution is to ask about it on OctoLinker and suggest its removal there. Perhaps the selector can be improved to avoid the Files tab. I'm not entirely sure of what it does.

.highlight also appears on Readmes and comments, so there's a chance that it's only needed there.

@fregante fregante changed the title Add review-comments-hidden-indicator feature Add hidden-review-comments-indicator feature Aug 14, 2019
Reduce opacity of indicator underline to make UI less noisy
This also reverts commit cd5abfc.
@sidvishnoi

sidvishnoi commented Aug 14, 2019 •

Copy link
Copy Markdown
Author

@fregante Made indicators toggle-able, not just hide-able. Please revert if you do not feel like supporting that feature.
Also, added a gif: https://user-images.githubusercontent.com/8426945/63024694-59722b80-bec5-11e9-812e-8c1df69a4243.gif

@sindresorhus

Copy link
Copy Markdown
Member

What's the purpose of hiding a visible comment? That's what the "Resolve" button is for, right?

@sidvishnoi

Copy link
Copy Markdown
Author

@sindresorhus While reviewing code, one may want to reduce the distractions in order to have a better picture of diff - so we hide comments, as requested in #1999. Resolve button is to tell comment has been resolved. So, entirely different purpose.

@sindresorhus

Copy link
Copy Markdown
Member

But there's already a button to hide all the comments. I don't really see the point in hiding a single comment.

@sidvishnoi

Copy link
Copy Markdown
Author

But there's already a button to hide all the comments.

Yes. It extends that functionality. The default one hides all comments, and one can't know if there are any comments unless they click that button again. This feature adds an indicator when comments are hidden.

I don't really see the point in hiding a single comment.

This feature hides all the comments, not a single comment.

@fregante

Copy link
Copy Markdown
Member

This feature hides all the comments, not a single comment.

It hides all the comments in a single file, which is the same feature already offered by GitHub. We can do without this

@fregante

Copy link
Copy Markdown
Member

Thanks for this feature @sidvishnoi! ^____^

@fregante
fregante merged commit 870a472 into refined-github:master Aug 15, 2019
@sidvishnoi

Copy link
Copy Markdown
Author

Oh, I totally missed split-diff view!

Thanks a lot @fregante for the insightful reviews and edits! 🎉
I learned a lot from this PR 🙂

@sidvishnoi
sidvishnoi deleted the toggle-comments branch August 15, 2019 18:24
@sidvishnoi
sidvishnoi restored the toggle-comments branch August 18, 2019 14:34
@just-be-dev

Copy link
Copy Markdown

Thanks for this! I was doing a code review and it started working. Very excited 😄

@fregante fregante mentioned this pull request Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Comment indicators when comments are hidden on PR review

4 participants