Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label to highest-rated comment #2177

Merged
merged 4 commits into from Jun 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion source/features/highest-rated-comment.tsx
Expand Up @@ -33,7 +33,18 @@ function init(): false | void {
const avatar = select('.timeline-comment-avatar', event)!.cloneNode(true);
const {hash} = select<HTMLAnchorElement>('.timestamp', event)!;

select('.unminimized-comment', event)!.classList.add('rgh-highest-rated-comment');
const comment = select('.unminimized-comment', event)!;

comment.classList.add('rgh-highest-rated-comment');

select('.timeline-comment-header .timeline-comment-header-text', event)!.parentElement!.lastElementChild!.before((
fregante marked this conversation as resolved.
Show resolved Hide resolved
<span
className="timeline-comment-label tooltipped"
fregante marked this conversation as resolved.
Show resolved Hide resolved
aria-label="This comment has the most positive reactions on this issue."
>
Highest-rated comment
</span>
));

const position = select.all('.js-comment').indexOf(highest.like.closest('.js-comment') as HTMLElement);
if (position >= 4) {
Expand Down