@@ -26,12 +26,12 @@ export class RepositoryChangesNode extends DescriptionNode implements vscode.Tre
2626
2727 constructor (
2828 public parent : BaseTreeNode ,
29- private _pullRequest : PullRequestModel ,
29+ pullRequest : PullRequestModel ,
3030 private _pullRequestManager : FolderRepositoryManager ,
3131 private _reviewModel : ReviewModel ,
3232 private _progress : ProgressHelper
3333 ) {
34- super ( parent , _pullRequest . title , _pullRequest , _pullRequestManager . repository , _pullRequestManager ) ;
34+ super ( parent , pullRequest . title , pullRequest , _pullRequestManager . repository , _pullRequestManager ) ;
3535 // Cause tree values to be filled
3636 this . getTreeItem ( ) ;
3737
@@ -59,7 +59,7 @@ export class RepositoryChangesNode extends DescriptionNode implements vscode.Tre
5959 } ) ,
6060 ) ;
6161
62- this . _disposables . push ( _pullRequest . onDidInvalidate ( ( ) => {
62+ this . _disposables . push ( this . pullRequestModel . onDidInvalidate ( ( ) => {
6363 this . refresh ( ) ;
6464 } ) ) ;
6565 }
@@ -77,34 +77,39 @@ export class RepositoryChangesNode extends DescriptionNode implements vscode.Tre
7777 await this . _progress . progress ;
7878 if ( ! this . _filesCategoryNode || ! this . _commitsCategoryNode ) {
7979 Logger . appendLine ( `Creating file and commit nodes for PR #${ this . pullRequestModel . number } ` , PR_TREE ) ;
80- this . _filesCategoryNode = new FilesCategoryNode ( this . parent , this . _reviewModel , this . _pullRequest ) ;
80+ this . _filesCategoryNode = new FilesCategoryNode ( this . parent , this . _reviewModel , this . pullRequestModel ) ;
8181 this . _commitsCategoryNode = new CommitsNode (
8282 this . parent ,
8383 this . _pullRequestManager ,
84- this . _pullRequest ,
84+ this . pullRequestModel ,
8585 ) ;
8686 }
8787 this . children = [ this . _filesCategoryNode , this . _commitsCategoryNode ] ;
8888 return this . children ;
8989 }
9090
91+ private setLabel ( ) {
92+ this . label = this . pullRequestModel . title ;
93+ if ( this . label . length > 50 ) {
94+ this . tooltip = this . label ;
95+ this . label = `${ this . label . substring ( 0 , 50 ) } ...` ;
96+ }
97+ }
98+
9199 async getTreeItem ( ) : Promise < vscode . TreeItem > {
92- this . label = this . _pullRequest . title ;
93- this . iconPath = ( await DataUri . avatarCirclesAsImageDataUris ( this . _pullRequestManager . context , [ this . _pullRequest . author ] , 16 , 16 ) ) [ 0 ] ;
100+ this . setLabel ( ) ;
101+ this . iconPath = ( await DataUri . avatarCirclesAsImageDataUris ( this . _pullRequestManager . context , [ this . pullRequestModel . author ] , 16 , 16 ) ) [ 0 ] ;
94102 this . description = undefined ;
95103 if ( this . parent . children ?. length && this . parent . children . length > 1 ) {
96104 const allSameOwner = this . parent . children . every ( child => {
97105 return child instanceof RepositoryChangesNode && child . pullRequestModel . remote . owner === this . pullRequestModel . remote . owner ;
98106 } ) ;
99107 if ( allSameOwner ) {
100- this . description = this . _pullRequest . remote . repositoryName ;
108+ this . description = this . pullRequestModel . remote . repositoryName ;
101109 } else {
102- this . description = `${ this . _pullRequest . remote . owner } /${ this . _pullRequest . remote . repositoryName } ` ;
103- }
104- if ( this . label . length > 35 ) {
105- this . tooltip = this . label ;
106- this . label = `${ this . label . substring ( 0 , 35 ) } ...` ;
110+ this . description = `${ this . pullRequestModel . remote . owner } /${ this . pullRequestModel . remote . repositoryName } ` ;
107111 }
112+
108113 }
109114 this . updateContextValue ( ) ;
110115 return this ;
0 commit comments