Skip to content

Commit c9912c4

Browse files
committed
Implement title for GH_ISSUE_ADD_COMMENT.
1 parent 08a4f65 commit c9912c4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/lib/enhancers/github/githubIssueAddComment.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class GitHubIssueAddCommentEnhancer implements CommentEnhancer<GitHubIssu
4242
const slug = `${owner}/${repo}`
4343
const number = parseInt(numberStr!, 10)
4444
const unique_key = `github.com:${slug}:${number}`
45-
const title = 'TODO_TITLE'
45+
const title = document.querySelector('main h1')!.textContent.replace(/#\d+$/, '').trim()
4646
return {
4747
domain: location.host,
4848
number,
@@ -77,7 +77,7 @@ export class GitHubIssueAddCommentEnhancer implements CommentEnhancer<GitHubIssu
7777
)
7878
}
7979

80-
tableTitle(_spot: GitHubIssueAddCommentSpot): string {
81-
return 'TITLE_TODO'
80+
tableTitle(spot: GitHubIssueAddCommentSpot): string {
81+
return spot.title
8282
}
8383
}

tests/lib/enhancers/github.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ describe('github', () => {
121121
"domain": "github.com",
122122
"number": 523,
123123
"slug": "diffplug/selfie",
124-
"title": "TODO_TITLE",
124+
"title": "[jvm] docs for VCR",
125125
"type": "GH_ISSUE_ADD_COMMENT",
126126
"unique_key": "github.com:diffplug/selfie:523",
127127
},
128-
"title": "TITLE_TODO",
128+
"title": "[jvm] docs for VCR",
129129
"upperDecoration": <React.Fragment>
130130
<span
131131
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
@@ -184,11 +184,11 @@ describe('github', () => {
184184
"domain": "github.com",
185185
"number": 56,
186186
"slug": "diffplug/gitcasso",
187-
"title": "TODO_TITLE",
187+
"title": "what about the draft?",
188188
"type": "GH_ISSUE_ADD_COMMENT",
189189
"unique_key": "github.com:diffplug/gitcasso:56",
190190
},
191-
"title": "TITLE_TODO",
191+
"title": "what about the draft?",
192192
"upperDecoration": <React.Fragment>
193193
<span
194194
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
@@ -213,11 +213,11 @@ describe('github', () => {
213213
"domain": "github.com",
214214
"number": 56,
215215
"slug": "diffplug/gitcasso",
216-
"title": "TODO_TITLE",
216+
"title": "what about the draft?",
217217
"type": "GH_ISSUE_ADD_COMMENT",
218218
"unique_key": "github.com:diffplug/gitcasso:56",
219219
},
220-
"title": "TITLE_TODO",
220+
"title": "what about the draft?",
221221
"upperDecoration": <React.Fragment>
222222
<span
223223
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"

0 commit comments

Comments
 (0)