Skip to content

Commit

Permalink
Extend linkify-labels-on-dashboard to newsfeed items (#3625)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakov116 committed Oct 9, 2020
1 parent 022e418 commit e02532a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ Thanks for contributing! 🦋🙌
- [](# "embed-gist-via-iframe") [Adds a menu item to embed a gist via `<iframe>`.](https://user-images.githubusercontent.com/44045911/63633382-6a1b6200-c67a-11e9-9038-aedd62e4f6a8.png)
- [](# "link-to-prior-blame-line") [Preserves the current line on “View blame prior to this change” links.](https://user-images.githubusercontent.com/1402241/60064482-26b47e00-9733-11e9-803c-c113ea612fbe.png)
- [](# "enable-file-links-in-compare-view") [Points the "View file" on compare view pages to the branch instead of the commit, so the Edit/Delete buttons will be enabled on the "View file" page, if needed.](https://user-images.githubusercontent.com/1402241/69044026-c5b17d80-0a26-11ea-86ae-c95f89d3669a.png)
- [](# "linkify-labels-on-dashboard") [Makes labels clickable in the dashboard’s "Recent activity" box.](https://user-images.githubusercontent.com/1402241/69045444-6ef97300-0a29-11ea-99a3-9a622c395709.png)
- [](# "linkify-labels-on-dashboard") [Makes labels clickable on the dashboard.](https://user-images.githubusercontent.com/1402241/69045444-6ef97300-0a29-11ea-99a3-9a622c395709.png)
- [](# "reload-failed-proxied-images") [Retries downloading images that failed downloading due to GitHub limited proxying.](https://user-images.githubusercontent.com/14858959/64068746-21991100-cc45-11e9-844e-827f5ac9b51e.png)
- [](# "unwrap-useless-dropdowns") [Makes some dropdowns 1-click instead of unnecessarily 2-click.](https://user-images.githubusercontent.com/1402241/80859624-9bfdb300-8c62-11ea-837f-7b7a28e6fdfc.png)
- [](# "linkify-notification-repository-header") [Linkifies the header of each notification group (when grouped by repository).](https://user-images.githubusercontent.com/1402241/80849887-81531c00-8c19-11ea-8777-7294ce318630.png)
Expand Down
11 changes: 8 additions & 3 deletions source/features/linkify-labels-on-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ import {wrap} from '../helpers/dom-utils';
import features from '.';

function init(): void {
observe('.js-recent-activity-container :not(a) > .IssueLabel', {
// A `:not(.rgh)` selector is not needed since we already check for `not(a)` #3625
const labelClass = [
'.js-recent-activity-container :not(a) > .IssueLabel', // Recent activity
'.js-all-activity-header + div :not(a) > .IssueLabel' // Newsfeed
].join();
observe(labelClass, {
add(label) {
const activity = label.closest('li')!;
const activity = label.closest('li, div:not([class])')!; // `div` is for the Newsfeed
const isPR = select.exists('.octicon-git-pull-request', activity);
const repository = select<HTMLAnchorElement>('a[data-hovercard-type="repository"]', activity)!;
const url = new URL(`${repository.href}/${isPR ? 'pulls' : 'issues'}`);
Expand All @@ -23,7 +28,7 @@ function init(): void {

void features.add({
id: __filebasename,
description: 'Makes labels clickable in the dashboard’s "Recent activity" box.',
description: 'Makes labels clickable on the dashboard.',
screenshot: 'https://user-images.githubusercontent.com/1402241/69045444-6ef97300-0a29-11ea-99a3-9a622c395709.png'
}, {
include: [
Expand Down

0 comments on commit e02532a

Please sign in to comment.