@@ -91,7 +91,12 @@ export class SessionLogViewManager extends Disposable implements vscode.WebviewP
91
91
}
92
92
93
93
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
+ } ;
95
100
const existingPanel = this . getPanelForPullRequest ( pullRequest ) ;
96
101
if ( existingPanel ) {
97
102
existingPanel . revealAndRefresh ( source ) ;
@@ -167,7 +172,7 @@ export class SessionLogViewManager extends Disposable implements vscode.WebviewP
167
172
}
168
173
169
174
type SessionLogSource =
170
- | { type : 'pull' , readonly pullRequest : SessionPullInfo & { title : string } ; readonly link : SessionLinkInfo }
175
+ | { type : 'pull' , readonly pullRequest : SessionLinkInfo & { title : string } ; readonly link : SessionLinkInfo }
171
176
| { type : 'session' , readonly sessionId : string }
172
177
;
173
178
@@ -256,11 +261,7 @@ class SessionLogView extends Disposable {
256
261
}
257
262
258
263
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 ;
264
265
}
265
266
266
267
public isForSession ( sessionId : string ) : boolean {
@@ -270,7 +271,7 @@ class SessionLogView extends Disposable {
270
271
public revealAndRefresh ( source : SessionLogSource ) : void {
271
272
if (
272
273
( 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 ) )
274
275
) {
275
276
// No need to reload content
276
277
this . webviewPanel . reveal ( ) ;
@@ -283,6 +284,10 @@ class SessionLogView extends Disposable {
283
284
284
285
private async initialize ( ) {
285
286
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
+ } ;
286
291
287
292
const distDir = vscode . Uri . joinPath ( this . context . extensionUri , 'dist' ) ;
288
293
@@ -393,6 +398,7 @@ class SessionLogView extends Disposable {
393
398
394
399
this . webviewPanel . webview . postMessage ( {
395
400
type : 'loaded' ,
401
+ pullInfo : this . _source . type === 'pull' ? this . _source . pullRequest : undefined ,
396
402
info : apiResponse . info ,
397
403
logs : apiResponse . logs
398
404
} as messages . LoadedMessage ) ;
@@ -413,6 +419,7 @@ class SessionLogView extends Disposable {
413
419
414
420
this . webviewPanel . webview . postMessage ( {
415
421
type : 'update' ,
422
+ pullInfo : this . _source . type === 'pull' ? this . _source . pullRequest : undefined ,
416
423
info : apiResult . info ,
417
424
logs : apiResult . logs
418
425
} as messages . UpdateMessage ) ;
@@ -434,17 +441,6 @@ class SessionLogView extends Disposable {
434
441
}
435
442
}
436
443
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 ;
450
446
}
0 commit comments