Skip to content

Commit

Permalink
Add jump-to-change-requested-comment feature (#3710)
Browse files Browse the repository at this point in the history
Co-authored-by: Federico <me@fregante.com>
  • Loading branch information
xtianatilano and fregante committed Nov 12, 2020
1 parent 97e2b9d commit e158e03
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ Thanks for contributing! 🦋🙌
- [](# "first-published-tag-for-merged-pr") 🔥 [Shows the first Git tag a merged PR was included in.](https://user-images.githubusercontent.com/16872793/81943321-38ac4300-95c9-11ea-8543-0f4858174e1e.png)
- [](# "pr-jump-to-first-non-viewed-file") [Jumps to first non-viewed file in a pull request when clicking on the progress bar.](https://user-images.githubusercontent.com/16872793/85226580-3bf3d500-b3a6-11ea-8494-3d9b6280d033.gif)
- [](# "git-checkout-pr") [Adds copy-pastable git commands to checkout a PR.](https://user-images.githubusercontent.com/16872793/96938908-8e024f80-1499-11eb-8976-0caf95175dd6.png)
- [](# "jump-to-change-requested-comment") [Adds a link to jump to the latest changed requested comment.](https://user-images.githubusercontent.com/19198931/98718312-418b9f00-23c9-11eb-8da2-dfb616e95eb6.gif)

<!-- Refer to style guide above. Keep this message between sections. -->

Expand Down
29 changes: 29 additions & 0 deletions source/features/jump-to-change-requested-comment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'dom-chef';
import select from 'select-dom';
import onetime from 'onetime';
import {observe} from 'selector-observer';
import * as pageDetect from 'github-url-detection';

import {wrap} from '../helpers/dom-utils';
import features from '.';

function init(): void {
observe('.review-item .dropdown-item[href^="#pullrequestreview-"]:not(.rgh-jump-to-change-requested-comment)', {
constructor: HTMLAnchorElement,
add(messageContainer) {
messageContainer.classList.add('rgh-jump-to-change-requested-comment');
const element = select('.review-status-item div[title*="requested changes"]')?.lastChild;

if (element) {
wrap(element, <a href={messageContainer.href}/>);
}
}
});
}

void features.add(__filebasename, {
include: [
pageDetect.isPRConversation
],
init: onetime(init)
});
1 change: 1 addition & 0 deletions source/refined-github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ import './features/convert-pr-to-draft-improvements';
import './features/git-checkout-pr';
import './features/unfinished-comments';
import './features/single-diff-column-selection';
import './features/jump-to-change-requested-comment';

// Add global for easier debugging
(window as any).select = select;

0 comments on commit e158e03

Please sign in to comment.