File tree Expand file tree Collapse file tree 3 files changed +71
-0
lines changed
tests/lib/enhancers/__snapshots__ Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,35 @@ export class GitHubIssueCreateEnhancer
37
37
return null
38
38
}
39
39
40
+ // Check for project board URLs first
41
+ const isProjectView = location . pathname . match (
42
+ / ^ \/ (?: o r g s | u s e r s ) \/ [ ^ / ] + \/ p r o j e c t s \/ \d + (?: \/ v i e w s \/ \d + ) ? /
43
+ )
44
+ if ( isProjectView ) {
45
+ // Check if we're in a "Create new issue" dialog
46
+ const dialog = textarea . closest ( '[role="dialog"]' )
47
+ if ( dialog ) {
48
+ const dialogHeading = dialog . querySelector ( "h1" ) ?. textContent
49
+ const slugMatch = dialogHeading ?. match ( / C r e a t e n e w i s s u e i n ( .+ ) / )
50
+ if ( slugMatch ) {
51
+ const slug = slugMatch [ 1 ] !
52
+ const unique_key = `github.com:${ slug } :new`
53
+ const titleInput = document . querySelector (
54
+ 'input[placeholder="Title"]'
55
+ ) as HTMLInputElement
56
+ const title = titleInput ?. value || ""
57
+ return {
58
+ domain : location . host ,
59
+ slug,
60
+ title,
61
+ type : GH_ISSUE_CREATE ,
62
+ unique_key,
63
+ }
64
+ }
65
+ }
66
+ return null
67
+ }
68
+
40
69
// Parse GitHub URL structure: /owner/repo/issues/123 or /owner/repo/pull/456
41
70
logger . debug ( `${ this . constructor . name } examing url` , location . pathname )
42
71
Original file line number Diff line number Diff line change @@ -273,3 +273,18 @@ exports[`github detection > gh_project_issue_edit:should detect correct spots 1`
273
273
} ,
274
274
]
275
275
` ;
276
+
277
+ exports [` github detection > gh_project_issue_new:should detect correct spots 1` ] = `
278
+ [
279
+ {
280
+ " for" : " id=:r4t: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
281
+ " spot" : {
282
+ " domain" : " github.com" ,
283
+ " slug" : " diffplug/gitcasso" ,
284
+ " title" : " Draft project title" ,
285
+ " type" : " GH_ISSUE_CREATE" ,
286
+ " unique_key" : " github.com:diffplug/gitcasso:new" ,
287
+ },
288
+ } ,
289
+ ]
290
+ ` ;
Original file line number Diff line number Diff line change @@ -348,3 +348,30 @@ exports[`github ui > gh_project_issue_edit:should render correct UI elements 1`]
348
348
} ,
349
349
]
350
350
` ;
351
+
352
+ exports [` github ui > gh_project_issue_new:should render correct UI elements 1` ] = `
353
+ [
354
+ {
355
+ " for" : " id=:r4t: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
356
+ " title" : " Draft project title" ,
357
+ " upperDecoration" : <React.Fragment >
358
+ <span
359
+ className = " flex h-4 w-4 flex-shrink-0 items-center justify-center"
360
+ >
361
+ <IssueOpenedIcon
362
+ size = { 16 }
363
+ />
364
+ </span >
365
+ <span >
366
+ < draft>
367
+
368
+ <LinkOutOfPopup
369
+ href = " https://github.com/diffplug/gitcasso"
370
+ >
371
+ diffplug/gitcasso
372
+ </LinkOutOfPopup >
373
+ </span >
374
+ </React.Fragment >,
375
+ } ,
376
+ ]
377
+ ` ;
You can’t perform that action at this time.
0 commit comments