Repository navigation
feat(cards): approve Linear, Sentry and Atlassian links; teach the card rule (TASK-336) #3208
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
Merged
+111
−17
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
89900c2
feat(cards): approve Linear, Sentry and Atlassian links; teach the ca…
lilyshen0722 d78fb23
fix(cards): approve the staging host the seed card links to
lilyshen0722 88cd720
test(cards): pin the host rule on the Link presentation component
lilyshen0722 2a14197
feat(cards): approve single-label Sentry org subdomains
lilyshen0722 5001666
fix(cards): degrade unapproved link hosts to the text fallback
lilyshen0722 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,17 @@ | ||
| export const UI_LINK_HOSTS = new Set(['commonly.me', 'docs.commonly.me', 'github.com']); | ||
| export const UI_LINK_HOSTS = new Set([ | ||
| 'commonly.me', 'staging.commonly.me', 'docs.commonly.me', 'github.com', 'linear.app', 'sentry.io', | ||
| ]); | ||
| // Suffix rules: a single-label Atlassian Cloud site (acme.atlassian.net) and a single-label | ||
| // Sentry org (my-organization.sentry.io). Nothing deeper. | ||
| const SITE_SUFFIX = /^[a-z0-9-]+\.(atlassian\.net|sentry\.io)$/; | ||
| export function isCardHost(hostname: string): boolean { | ||
| return UI_LINK_HOSTS.has(hostname) || SITE_SUFFIX.test(hostname); | ||
| } | ||
| export function cardHref(raw: unknown): URL | null { | ||
| if (typeof raw !== 'string') return null; | ||
| try { | ||
| const url = new URL(raw); | ||
| return url.protocol === 'https:' && !url.username && !url.password && !url.port | ||
| && UI_LINK_HOSTS.has(url.hostname) ? url : null; | ||
| && isCardHost(url.hostname) ? url : null; | ||
| } catch { return null; } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.