Skip to content

Commit 96c464f

Browse files
committed
Rename domain -> host to better match the underlying window.location api.
1 parent 6d5d0a9 commit 96c464f

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

browser-extension/src/entrypoints/content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const enhancedTextareas = new TextareaRegistry()
1111

1212
function detectLocation(): StrippedLocation {
1313
return {
14-
domain: window.location.host,
14+
host: window.location.host,
1515
pathname: window.location.pathname,
1616
}
1717
}

browser-extension/src/lib/enhancer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface CommentEvent {
2424
* Avoids dependency on global window/location objects for better testability.
2525
*/
2626
export interface StrippedLocation {
27-
domain: string
27+
host: string
2828
pathname: string
2929
}
3030

browser-extension/src/lib/enhancers/github/githubIssueAddComment.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class GitHubIssueAddCommentEnhancer implements CommentEnhancer<GitHubIssu
2727
if (textarea.id === 'feedback') {
2828
return null
2929
}
30-
if (location.domain !== 'github.com') {
30+
if (location.host !== 'github.com') {
3131
return null
3232
}
3333

@@ -44,7 +44,7 @@ export class GitHubIssueAddCommentEnhancer implements CommentEnhancer<GitHubIssu
4444
const unique_key = `github.com:${slug}:${number}`
4545
const title = 'TODO_TITLE'
4646
return {
47-
domain: location.domain,
47+
domain: location.host,
4848
number,
4949
slug,
5050
title,

browser-extension/src/lib/enhancers/github/githubIssueNewComment.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class GitHubIssueNewCommentEnhancer implements CommentEnhancer<GitHubIssu
2020
_textarea: HTMLTextAreaElement,
2121
location: StrippedLocation,
2222
): GitHubIssueNewCommentSpot | null {
23-
if (location.domain !== 'github.com') {
23+
if (location.host !== 'github.com') {
2424
return null
2525
}
2626

@@ -35,7 +35,7 @@ export class GitHubIssueNewCommentEnhancer implements CommentEnhancer<GitHubIssu
3535
const slug = `${owner}/${repo}`
3636
const unique_key = `github.com:${slug}:new`
3737
return {
38-
domain: location.domain,
38+
domain: location.host,
3939
slug,
4040
type: 'GH_ISSUE_NEW_COMMENT',
4141
unique_key,

browser-extension/src/lib/enhancers/github/githubPRAddComment.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class GitHubPRAddCommentEnhancer implements CommentEnhancer<GitHubPRAddCo
2424
location: StrippedLocation,
2525
): GitHubPRAddCommentSpot | null {
2626
// Only handle github.com domains TODO: identify GitHub Enterprise somehow
27-
if (location.domain !== 'github.com' || _textarea.id !== 'new_comment_field') {
27+
if (location.host !== 'github.com' || _textarea.id !== 'new_comment_field') {
2828
return null
2929
}
3030

@@ -40,7 +40,7 @@ export class GitHubPRAddCommentEnhancer implements CommentEnhancer<GitHubPRAddCo
4040
const unique_key = `github.com:${slug}:${number}`
4141
const title = 'TODO_TITLE'
4242
return {
43-
domain: location.domain,
43+
domain: location.host,
4444
number,
4545
slug,
4646
title,

browser-extension/src/lib/enhancers/github/githubPRNewComment.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class GitHubPRNewCommentEnhancer implements CommentEnhancer<GitHubPRNewCo
2323
if (textarea.id === 'feedback') {
2424
return null
2525
}
26-
if (location.domain !== 'github.com') {
26+
if (location.host !== 'github.com') {
2727
return null
2828
}
2929

@@ -43,7 +43,7 @@ export class GitHubPRNewCommentEnhancer implements CommentEnhancer<GitHubPRNewCo
4343
: `${owner}/${repo}/${compareBranch}`
4444
const unique_key = `github.com:${slug}`
4545
return {
46-
domain: location.domain,
46+
domain: location.host,
4747
slug,
4848
type: 'GH_PR_NEW_COMMENT',
4949
unique_key,

browser-extension/tests/har-view.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ function injectGitcassoScript(key: keyof typeof PAGES, html: string) {
334334
/function detectLocation(): StrippedLocation {[sS]*?}/,
335335
'function detectLocation() {\\n' +
336336
' return {\\n' +
337-
' domain: \\'${urlParts.host}\\',\\n' +
337+
' host: \\'${urlParts.host}\\',\\n' +
338338
' pathname: \\'${urlParts.pathname}\\'\\n' +
339339
' };\\n' +
340340
'}'

browser-extension/tests/lib/enhancers/github.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const enhancers = new EnhancerRegistry()
1010
function enhancements(document: Document, window: Window) {
1111
const textareas = document.querySelectorAll('textarea')
1212
const location: StrippedLocation = {
13-
domain: window.location.host,
13+
host: window.location.host,
1414
pathname: window.location.pathname,
1515
}
1616
const spotsFound = []

0 commit comments

Comments
 (0)