@@ -16,6 +16,8 @@ interface Issue {
1616 number : number ;
1717 title : string ;
1818 body : string ;
19+ state : string ;
20+ stateReason : string ;
1921 url : string ;
2022 author : { login : string } ;
2123 labels : Array < { name : string } > ;
@@ -88,6 +90,13 @@ const getReactionCount = (issue: Issue | Candidate | undefined) => {
8890 ) ;
8991} ;
9092
93+ const getStateColor = ( state : string , stateReason ?: string ) => {
94+ if ( stateReason ?. toLowerCase ( ) === 'duplicate' ) {
95+ return 'magenta' ;
96+ }
97+ return state === 'OPEN' ? 'green' : 'red' ;
98+ } ;
99+
91100export const TriageDuplicates = ( {
92101 config,
93102 onExit,
@@ -146,7 +155,7 @@ export const TriageDuplicates = ({
146155 'view' ,
147156 String ( number ) ,
148157 '--json' ,
149- 'number,title,body,labels,url,comments,author,reactionGroups' ,
158+ 'number,title,body,state,stateReason, labels,url,comments,author,reactionGroups' ,
150159 ] ) ;
151160 return JSON . parse ( stdout ) as Candidate ;
152161 } catch ( err ) {
@@ -283,6 +292,8 @@ Return a JSON object with:
283292 number : rec . canonical_issue_number ,
284293 title : 'Unknown' ,
285294 url : '' ,
295+ state : 'UNKNOWN' ,
296+ stateReason : '' ,
286297 author : { login : 'unknown' } ,
287298 labels : [ ] ,
288299 comments : [ ] ,
@@ -433,7 +444,7 @@ Return a JSON object with:
433444 '--state' ,
434445 'open' ,
435446 '--json' ,
436- 'number,title,body,labels,url,comments,author,reactionGroups' ,
447+ 'number,title,body,state,stateReason, labels,url,comments,author,reactionGroups' ,
437448 '--limit' ,
438449 String ( limit ) ,
439450 ] ) ;
@@ -916,6 +927,14 @@ Return a JSON object with:
916927 ) : (
917928 visibleCandidates . map ( ( c : Candidate , i : number ) => {
918929 const absoluteIndex = candidateListScrollOffset + i ;
930+ const isDuplicateOfCurrent =
931+ currentIssue &&
932+ c . comments . some ( ( comment ) =>
933+ comment . body
934+ . toLowerCase ( )
935+ . includes ( `duplicate of #${ currentIssue . number } ` ) ,
936+ ) ;
937+
919938 return (
920939 < Box key = { c . number } flexDirection = "column" marginLeft = { 1 } >
921940 < Text
@@ -932,8 +951,16 @@ Return a JSON object with:
932951 }
933952 wrap = "truncate-end"
934953 >
935- { absoluteIndex + 1 } . < Text bold > #{ c . number } </ Text > -{ ' ' }
936- { c . title } (Score: { c . score } /100)
954+ { absoluteIndex + 1 } . < Text bold > #{ c . number } </ Text > { ' ' }
955+ < Text color = { getStateColor ( c . state , c . stateReason ) } >
956+ [{ ( c . stateReason || c . state ) . toUpperCase ( ) } ]
957+ </ Text > { ' ' }
958+ { isDuplicateOfCurrent && (
959+ < Text color = "red" bold >
960+ [DUPLICATE OF CURRENT]{ ' ' }
961+ </ Text >
962+ ) }
963+ - { c . title } (Score: { c . score } /100)
937964 </ Text >
938965 < Box marginLeft = { 2 } >
939966 < Text color = "gray" wrap = "truncate-end" >
0 commit comments