@@ -91,7 +91,12 @@ export class SessionLogViewManager extends Disposable implements vscode.WebviewP
9191 }
9292
9393 async openForPull ( pullRequest : PullRequestModel , link : SessionLinkInfo , openToTheSide ?: boolean ) : Promise < void > {
94- const source : SessionLogSource = { type : 'pull' , pullRequest : toPullInfo ( pullRequest ) , link } ;
94+ const source : SessionLogSource = {
95+ type : 'pull' , pullRequest : {
96+ ...link ,
97+ title : pullRequest . title
98+ } , link
99+ } ;
95100 const existingPanel = this . getPanelForPullRequest ( pullRequest ) ;
96101 if ( existingPanel ) {
97102 existingPanel . revealAndRefresh ( source ) ;
@@ -167,7 +172,7 @@ export class SessionLogViewManager extends Disposable implements vscode.WebviewP
167172}
168173
169174type SessionLogSource =
170- | { type : 'pull' , readonly pullRequest : SessionPullInfo & { title : string } ; readonly link : SessionLinkInfo }
175+ | { type : 'pull' , readonly pullRequest : SessionLinkInfo & { title : string } ; readonly link : SessionLinkInfo }
171176 | { type : 'session' , readonly sessionId : string }
172177 ;
173178
@@ -256,11 +261,7 @@ class SessionLogView extends Disposable {
256261 }
257262
258263 public isForPullRequest ( pullRequest : PullRequestModel ) : boolean {
259- if ( this . _source . type !== 'pull' ) {
260- return false ;
261- }
262- const inInfo = toPullInfo ( pullRequest ) ;
263- return arePullInfosEqual ( this . _source . pullRequest , inInfo ) ;
264+ return this . _source . type === 'pull' && this . _source . pullRequest . id === pullRequest . id ;
264265 }
265266
266267 public isForSession ( sessionId : string ) : boolean {
@@ -270,7 +271,7 @@ class SessionLogView extends Disposable {
270271 public revealAndRefresh ( source : SessionLogSource ) : void {
271272 if (
272273 ( this . _source . type === 'session' && source . type === 'session' && this . _source . sessionId === source . sessionId )
273- || ( this . _source . type === 'pull' && source . type === 'pull' && arePullInfosEqual ( this . _source . pullRequest , source . pullRequest ) )
274+ || ( this . _source . type === 'pull' && source . type === 'pull' && arePullLinksEqual ( this . _source . pullRequest , source . pullRequest ) )
274275 ) {
275276 // No need to reload content
276277 this . webviewPanel . reveal ( ) ;
@@ -283,6 +284,10 @@ class SessionLogView extends Disposable {
283284
284285 private async initialize ( ) {
285286 this . webviewPanel . title = this . _source . type === 'pull' ? vscode . l10n . t ( `Session Log (Pull #{0})` , this . _source . pullRequest . pullNumber ) : vscode . l10n . t ( 'Session Log' ) ;
287+ this . webviewPanel . iconPath = {
288+ light : vscode . Uri . joinPath ( this . context . extensionUri , 'resources/icons/output.svg' ) ,
289+ dark : vscode . Uri . joinPath ( this . context . extensionUri , 'resources/icons/dark/output.svg' )
290+ } ;
286291
287292 const distDir = vscode . Uri . joinPath ( this . context . extensionUri , 'dist' ) ;
288293
@@ -393,6 +398,7 @@ class SessionLogView extends Disposable {
393398
394399 this . webviewPanel . webview . postMessage ( {
395400 type : 'loaded' ,
401+ pullInfo : this . _source . type === 'pull' ? this . _source . pullRequest : undefined ,
396402 info : apiResponse . info ,
397403 logs : apiResponse . logs
398404 } as messages . LoadedMessage ) ;
@@ -413,6 +419,7 @@ class SessionLogView extends Disposable {
413419
414420 this . webviewPanel . webview . postMessage ( {
415421 type : 'update' ,
422+ pullInfo : this . _source . type === 'pull' ? this . _source . pullRequest : undefined ,
416423 info : apiResult . info ,
417424 logs : apiResult . logs
418425 } as messages . UpdateMessage ) ;
@@ -434,17 +441,6 @@ class SessionLogView extends Disposable {
434441 }
435442}
436443
437- function toPullInfo ( pullRequest : PullRequestModel ) : SessionPullInfo & { title : string ; } {
438- return {
439- id : pullRequest . id ,
440- host : pullRequest . githubRepository . remote . gitProtocol . host ,
441- owner : pullRequest . githubRepository . remote . owner ,
442- repo : pullRequest . githubRepository . remote . repositoryName ,
443- pullNumber : pullRequest . number ,
444- title : pullRequest . title ,
445- } ;
446- }
447-
448- function arePullInfosEqual ( a : SessionPullInfo , b : SessionPullInfo ) : boolean {
449- return a . id === b . id ;
444+ function arePullLinksEqual ( a : SessionLinkInfo , b : SessionLinkInfo ) : boolean {
445+ return a . id === b . id && a . sessionIndex === b . sessionIndex ;
450446}
0 commit comments