Skip to content

Commit df73818

Browse files
committed
Instead of doing window.location.hostname, look at document.querySelector('meta[name="hostname"]')?.getAttribute('content')
It's just because we can't mock the domain very well...
1 parent 751816e commit df73818

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

browser-extension/src/lib/enhancers/github.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export class GitHubAddCommentEnhancer implements CommentEnhancer<GitHubAddCommen
3030
}
3131

3232
tryToEnhance(textarea: HTMLTextAreaElement): [OverTypeInstance, GitHubAddCommentSpot] | null {
33-
// Only handle github.com domains TODO: identify GitHub Enterprise somehow
34-
if (window.location.hostname !== 'github.com') {
33+
// Only handle github.com domains - check meta tag for testing compatibility
34+
if (document.querySelector('meta[name="hostname"]')?.getAttribute('content') !== 'github.com') {
3535
return null
3636
}
3737

0 commit comments

Comments
 (0)