summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Connor Love <connor@dotconnor.com> 2019-05-20 23:35:42 -0400
committerGravatar Federico Brigante <github@bfred.it> 2019-05-21 11:35:42 +0800
commit884b36218c90d6efd274ac877606ade1e500c545 (patch)
treead93902f36ef7294873e88d91a04b374bfac1623
parentb56e3fed1c2a0004b5f7d097a632f59101bcfb4a (diff)
downloadrefined-github-884b36218c90d6efd274ac877606ade1e500c545.tar.gz
refined-github-884b36218c90d6efd274ac877606ade1e500c545.tar.zst
refined-github-884b36218c90d6efd274ac877606ade1e500c545.zip
Add `open-issue-to-latest-comment` feature (#2028)
-rw-r--r--.github/CODEOWNERS1
-rw-r--r--readme.md1
-rw-r--r--source/content.ts1
-rw-r--r--source/features/open-issue-to-latest-comment.tsx18
4 files changed, 21 insertions, 0 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index b287817d..f939f880 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -3,3 +3,4 @@ source/features/tags-dropdown.tsx @HardikModha
source/features/tag-changelog-link.tsx @HardikModha
source/features/link-to-file-in-file-history.tsx @HardikModha
source/features/default-to-rich-diff.tsx @idasbiste
+source/features/open-issue-to-latest-comment.tsx @dotconnor
diff --git a/readme.md b/readme.md
index 978cbd0e..6b614198 100644
--- a/readme.md
+++ b/readme.md
@@ -207,6 +207,7 @@ GitHub Enterprise is also supported. More info in the options.
- [Search or select tags from a dropdown in the `Releases` page.](https://user-images.githubusercontent.com/22439276/56373231-27ee9980-621e-11e9-9b21-601919d3dddf.png)
- [Link to file itself in the history pages](https://user-images.githubusercontent.com/22439276/57195061-b88ddf00-6f6b-11e9-8ad9-13225d09266d.png)
- [See an automatic changelog for each tag or release.](https://user-images.githubusercontent.com/1402241/57081611-ad4a7180-6d27-11e9-9cb6-c54ec1ac18bb.png)
+- [Open issues to the latest comment by clicking the comments icon.](https://user-images.githubusercontent.com/14323370/57962709-7019de00-78e8-11e9-8398-7e617ba7a96f.png)
### Previously part of Refined GitHub
diff --git a/source/content.ts b/source/content.ts
index 55db8d4f..0cf020d6 100644
--- a/source/content.ts
+++ b/source/content.ts
@@ -102,6 +102,7 @@ import './features/hide-disabled-milestone-sorter';
import './features/tag-changelog-link';
import './features/link-to-file-in-file-history';
import './features/clean-sidebar';
+import './features/open-issue-to-latest-comment';
import './features/scrollable-code-and-blockquote.css';
import './features/center-reactions-popup.css';
diff --git a/source/features/open-issue-to-latest-comment.tsx b/source/features/open-issue-to-latest-comment.tsx
new file mode 100644
index 00000000..c57d1276
--- /dev/null
+++ b/source/features/open-issue-to-latest-comment.tsx
@@ -0,0 +1,18 @@
+import select from 'select-dom';
+import features from '../libs/features';
+
+function init(): void {
+ for (const link of select.all<HTMLAnchorElement>('.js-issue-row a[aria-label*="comment"]')) {
+ link.hash = '#partial-timeline';
+ }
+}
+
+features.add({
+ id: 'open-issue-to-latest-comment',
+ description: 'Clicking the comments icon in issue lists will take you to latest comment.',
+ include: [
+ features.isDiscussionList
+ ],
+ load: features.onAjaxedPages,
+ init
+});