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

linkify-code - Fix issue links on global search pages #7005

Merged
merged 8 commits into from
Nov 1, 2023
Merged

linkify-code - Fix issue links on global search pages #7005

merged 8 commits into from
Nov 1, 2023

Conversation

Katsute
Copy link
Contributor

@Katsute Katsute commented Oct 29, 2023

Fixes #6996

Retrieves the repository using the line url when getRepo doesn't work

image

/notion-enhancer/notion-repackaged/blob/4eefa99dc1bcde18268d70bb2b7f050786229feb/scripts/extract-src.sh#L50

↑ pull repo from this

Test URLs

https://github.com/search?q=repo%3Anotion-enhancer%2Fnotion-repackaged%20sqlite&type=code

https://github.com/search?q=org%3Arefined-github+%2F%23%5Cd%2B%2F&type=code

https://github.com/search?q=%2F%23%5Cd%7B4%2C%7D%2F+language%3Atypescript&type=code

Screenshot

image


image

@fregante fregante added the bug label Nov 1, 2023
linkifyIssues(currentRepo, element);
}
const currentRepo = pageDetect.isGlobalSearchResults()
? getRepo(wrapper.parentElement!.querySelector('.blob-num a')!.href)
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this works? The wrapper seems to be a td, so the parentElement is a tr, which does not contain any links.

Screenshot 14

The right ancestor is probably Box-sc-g0xbh4-0 kNKjla, which is hard to target 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The selector targets the line link, rather than the repo link at the top of each file.

tr (parent) .blob-num a seems to work properly, seeing as the hovercard shows (screenshot ^)

image

Copy link
Member

Choose a reason for hiding this comment

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

Oh neat, I thought it was targeting the file header

source/features/linkify-code.tsx Outdated Show resolved Hide resolved
@fregante fregante enabled auto-merge (squash) November 1, 2023 16:49
@fregante fregante changed the title linkify-code - Fix on search pages linkify-code - Fix issue links on global search pages Nov 1, 2023
@fregante fregante merged commit 9987023 into refined-github:main Nov 1, 2023
10 checks passed
@Katsute Katsute deleted the linkify-code-search branch November 1, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

linkify-code breaks on search page
2 participants