Skip to content

Enable hide-user-forks on more links - #6466

Closed
kidonng wants to merge 4 commits into
mainfrom
set-default-repositories-type-to-sources
Closed

kidonng wants to merge 4 commits into
mainfrom
set-default-repositories-type-to-sources

Conversation

@kidonng

@kidonng kidonng commented Apr 7, 2023 •

Copy link
Copy Markdown
Member

@kidonng

kidonng commented Apr 9, 2023 •

Copy link
Copy Markdown
Member Author

Now it still misses direct links to organization profiles, i.e.

https://github.com/refined-github

But it's not worth it to check every link isProfile just for this, especially since we can't tell if it is an organization without extra network requests.

Comment on lines +13 to 17
`a:is([href^="/"], [href^="${location.origin}"])[href$="?tab=repositories"]`, // "Repositories" tab on user profile, only matches relative or same-origin links
`a:is([href^="/orgs/"], [href^="${location.origin}/orgs/"])[href$="/repositories"]`, // "Repositories" tab on organization profile, only matches relative or same-origin links
'[aria-label="Organization"] [data-tab-item="org-header-overview-tab"] a', // "Overview" tab on organization profile
'[aria-label="Organization"] a[data-tab-item="i0overview-tab"]', // "Overview" tab on organization profile (Global navigation update)
'a[data-hovercard-type="organization"]', // Organization name on repo header + organization list on user profile

@fregante fregante Apr 9, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should not depend on any classes/attributes.

Now it still misses direct links to organization profiles, i.e.

https://github.com/refined-github

This feature does not target those links, it should target every:

  • /*?tab=repositories
  • /orgs/*/repositories/

otherwise we're back to square one (i.e. "some links don't work")

I think the solution is only these 2 selectors (also note the [attr]:is() order)

		// User repos
		`a[href$="?tab=repositories"]:is([href^="/"], [href^="${location.origin}/"])`,

		// Organization repos
		`a[href$="/repositories"]:is([href^="/orgs/"], [href^="${location.origin}/orgs/"])`,

I don’t think that this will target a lot of invalid links, we'll only want to run something like isUserRepositories/isOrgRepositories to make sure we don't alter the wrong link (if any)

@kidonng kidonng Apr 16, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We should not depend on any classes/attributes.

Did you mean we drop support for these?

Screenshot 2023-04-16 at 20 16 39


Screenshot 2023-04-16 at 20 16 57

This feature does not target those links

Those were mentioned for completeness, I never intended to support them.

also note the [attr]:is() order

This is following logic order (starts with ^= then ends with $=), but I don't mind either way.

Comment on lines +29 to +30
- User profile: https://github.com/fregante
- Organization profile: https://github.com/refined-github

@fregante fregante Apr 9, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To avoid confusion: These aren't the only URLs on which the feature runs, it runs everywhere. Instead of "test URLs" we need a list of examples to test, e.g.

Suggested change
- User profile: https://github.com/fregante
- Organization profile: https://github.com/refined-github
## Test
- https://github.com/fregante?tab=repositories
- https://github.com/orgs/refined-github/repositories
- The "Your repositories" link in the user dropdown in the header
- The "Repositories" tab in
- https://github.com/fregante
- https://github.com/refined-github

which would appear as:

Test

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd also change the name of the feature to something more reasonable because such long features are impossible to mention in commit titles. I'd go for hide-user-forks maybe

@fregante fregante changed the title Enable set-default-repositories-type-to-sources on more links Enable hide-user-forks on more links Apr 12, 2023
@FloEdelmann
FloEdelmann deleted the set-default-repositories-type-to-sources branch April 21, 2023 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

hide-user-forks missing from some links

2 participants