Skip to content

Commit f616227

Browse files
committed
Correct titles for Issue and PR Add Comment.
1 parent c9912c4 commit f616227

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/lib/enhancers/github/githubIssueAddComment.tsx

Lines changed: 1 addition & 1 deletion
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 = document.querySelector('main h1')!.textContent.replace(/#\d+$/, '').trim()
45+
const title = document.querySelector('main h1')!.textContent.replace(/\s*#\d+$/, '').trim()
4646
return {
4747
domain: location.host,
4848
number,

src/lib/enhancers/github/githubPRAddComment.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class GitHubPRAddCommentEnhancer implements CommentEnhancer<GitHubPRAddCo
3838
const slug = `${owner}/${repo}`
3939
const number = parseInt(numberStr!, 10)
4040
const unique_key = `github.com:${slug}:${number}`
41-
const title = 'TODO_TITLE'
41+
const title = document.querySelector('main h1')!.textContent.replace(/\s*#\d+$/, '').trim()
4242
return {
4343
domain: location.host,
4444
number,
@@ -70,7 +70,7 @@ export class GitHubPRAddCommentEnhancer implements CommentEnhancer<GitHubPRAddCo
7070
)
7171
}
7272

73-
tableTitle(_spot: GitHubPRAddCommentSpot): string {
74-
return 'TITLE_TODO'
73+
tableTitle(spot: GitHubPRAddCommentSpot): string {
74+
return spot.title
7575
}
7676
}

tests/lib/enhancers/github.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ describe('github', () => {
4848
"domain": "github.com",
4949
"number": 517,
5050
"slug": "diffplug/selfie",
51-
"title": "TODO_TITLE",
51+
"title": "Add "VCR" functionality
52+
#517",
5253
"type": "GH_PR_ADD_COMMENT",
5354
"unique_key": "github.com:diffplug/selfie:517",
5455
},
55-
"title": "TITLE_TODO",
56+
"title": "Add "VCR" functionality
57+
#517",
5658
"upperDecoration": <React.Fragment>
5759
<span
5860
className="font-mono text-muted-foreground text-sm"
@@ -273,11 +275,15 @@ describe('github', () => {
273275
"domain": "github.com",
274276
"number": 58,
275277
"slug": "diffplug/gitcasso",
276-
"title": "TODO_TITLE",
278+
"title": "Feat/expand corpus
279+
280+
#58",
277281
"type": "GH_PR_ADD_COMMENT",
278282
"unique_key": "github.com:diffplug/gitcasso:58",
279283
},
280-
"title": "TITLE_TODO",
284+
"title": "Feat/expand corpus
285+
286+
#58",
281287
"upperDecoration": <React.Fragment>
282288
<span
283289
className="font-mono text-muted-foreground text-sm"

0 commit comments

Comments
 (0)