@@ -359,9 +359,10 @@ describe("rightPanelStore", () => {
359359 const revision = store . getUserActionRevision ( refA ) ;
360360
361361 expect ( store . openProactive ( refA , relinkedPullRequest , revision , true ) ) . toBe ( true ) ;
362- expect ( selectActiveRightPanelSurface ( useRightPanelStore . getState ( ) . byThreadKey , refA ) ) . toEqual (
363- relinkedPullRequest ,
364- ) ;
362+ expect ( selectActiveRightPanelSurface ( useRightPanelStore . getState ( ) . byThreadKey , refA ) ) . toEqual ( {
363+ ...relinkedPullRequest ,
364+ attentionRequestId : 1 ,
365+ } ) ;
365366
366367 store . close ( refA ) ;
367368 expect ( store . openProactive ( refA , linkedPullRequest , revision , true ) ) . toBe ( false ) ;
@@ -609,6 +610,7 @@ describe("rightPanelStore", () => {
609610 projectId : "project-a" ,
610611 repository : "pingdotgg/t3code" ,
611612 number : 4909 ,
613+ attentionRequestId : 0 ,
612614 } ,
613615 ] ,
614616 } ,
@@ -633,6 +635,7 @@ describe("rightPanelStore", () => {
633635 projectId : "project-a" ,
634636 repository : "pingdotgg/t3code" ,
635637 number : 4909 ,
638+ attentionRequestId : 0 ,
636639 } ,
637640 ] ,
638641 } ;
@@ -1007,10 +1010,24 @@ describe("rightPanelStore", () => {
10071010 expect ( state . activeSurfaceId ) . toBe ( pullRequestSurfaceId ( first ) ) ;
10081011 expect (
10091012 selectActiveRightPanelSurface ( useRightPanelStore . getState ( ) . byThreadKey , refA ) ,
1010- ) . toMatchObject ( { url } ) ;
1013+ ) . toMatchObject ( { url, attentionRequestId : 3 } ) ;
1014+ expect ( state . surfaces [ 1 ] ) . toMatchObject ( { attentionRequestId : 1 } ) ;
10111015 expect ( state . surfaces [ 1 ] ) . not . toHaveProperty ( "url" ) ;
10121016 } ) ;
10131017
1018+ it ( "bumps attention when reopening the pull request already in the panel" , ( ) => {
1019+ const pr = { projectId : "project-a" , repository : "pingdotgg/t3code" , number : 4909 } ;
1020+ useRightPanelStore . getState ( ) . openPullRequest ( refA , pr ) ;
1021+ expect (
1022+ selectActiveRightPanelSurface ( useRightPanelStore . getState ( ) . byThreadKey , refA ) ,
1023+ ) . toMatchObject ( { attentionRequestId : 1 } ) ;
1024+
1025+ useRightPanelStore . getState ( ) . openPullRequest ( refA , pr ) ;
1026+ expect (
1027+ selectActiveRightPanelSurface ( useRightPanelStore . getState ( ) . byThreadKey , refA ) ,
1028+ ) . toMatchObject ( { attentionRequestId : 2 } ) ;
1029+ } ) ;
1030+
10141031 it ( "restores each environment, thread and PR surface's detail tab after reload and URL reopen" , async ( ) => {
10151032 const pr = { projectId : "project-a" , repository : "pingdotgg/t3code" , number : 4909 } ;
10161033 const otherPr = { ...pr , projectId : "project-b" } ;
@@ -1073,7 +1090,10 @@ describe("rightPanelStore", () => {
10731090 useRightPanelStore . getState ( ) . openPullRequest ( refA , first ) ;
10741091 useRightPanelStore . getState ( ) . openPullRequest ( refA , second ) ;
10751092 const state = selectThreadRightPanelState ( useRightPanelStore . getState ( ) . byThreadKey , refA ) ;
1076- expect ( state . surfaces ) . toEqual ( [ pullRequestSurface ( first ) , pullRequestSurface ( second ) ] ) ;
1093+ expect ( state . surfaces ) . toEqual ( [
1094+ pullRequestSurface ( { ...first , attentionRequestId : 1 } ) ,
1095+ pullRequestSurface ( { ...second , attentionRequestId : 1 } ) ,
1096+ ] ) ;
10771097 expect ( pullRequestSurfaceId ( { ...first , host : "GITHUB.COM" } ) ) . toBe (
10781098 pullRequestSurfaceId ( first ) ,
10791099 ) ;
0 commit comments