@@ -742,6 +742,26 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
742742 const pendingReviewId = await this . getPendingReviewId ( ) ;
743743
744744 const { mutate, schema } = await this . githubRepository . ensure ( ) ;
745+
746+ let linePositioning : any ;
747+ let multilinePositioning : any ;
748+ if ( startLine === endLine && startLine !== undefined ) {
749+ linePositioning = {
750+ line : startLine ,
751+ path : commentPath ,
752+ commitOid : this . head ?. sha
753+ } ;
754+ } else if ( startLine !== undefined && endLine !== undefined ) {
755+ multilinePositioning = {
756+ startLine,
757+ endLine,
758+ startPath : commentPath ,
759+ endPath : commentPath ,
760+ startCommitOid : this . head ?. sha ,
761+ endCommitOid : this . head ?. sha
762+ } ;
763+ }
764+
745765 const { data } = await mutate < AddReviewThreadResponse > ( {
746766 mutation : schema . AddReviewThread ,
747767 variables : {
@@ -753,7 +773,9 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
753773 startLine : startLine === endLine ? undefined : startLine ,
754774 line : ( endLine === undefined ) ? 0 : endLine ,
755775 side,
756- subjectType : ( startLine === undefined || endLine === undefined ) ? SubjectType . FILE : SubjectType . LINE
776+ subjectType : ( startLine === undefined || endLine === undefined ) ? SubjectType . FILE : SubjectType . LINE ,
777+ linePositioning,
778+ multilinePositioning
757779 }
758780 }
759781 } , { mutation : schema . LegacyAddReviewThread , deleteProps : [ 'subjectType' ] } ) ;
@@ -772,7 +794,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
772794 }
773795
774796 const thread = data . addPullRequestReviewThread . thread ;
775- const newThread = parseGraphQLReviewThread ( thread , this . githubRepository ) ;
797+ const newThread = parseGraphQLReviewThread ( thread , this . githubRepository , this . head ?. sha ) ;
776798 if ( ! this . _reviewThreadsCache ) {
777799 this . _reviewThreadsCache = [ ] ;
778800 }
@@ -1453,7 +1475,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
14531475 }
14541476
14551477 private setReviewThreadCacheFromRaw ( raw : ReviewThread [ ] ) : IReviewThread [ ] {
1456- const reviewThreads : IReviewThread [ ] = raw . map ( thread => parseGraphQLReviewThread ( thread , this . githubRepository ) ) ;
1478+ const reviewThreads : IReviewThread [ ] = raw . map ( thread => parseGraphQLReviewThread ( thread , this . githubRepository , this . head ?. sha ) ) ;
14571479 const oldReviewThreads = this . _reviewThreadsCache ?? [ ] ;
14581480 this . _reviewThreadsCache = reviewThreads ;
14591481 this . diffThreads ( oldReviewThreads , reviewThreads ) ;
@@ -2105,7 +2127,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
21052127
21062128 const index = this . _reviewThreadsCache ?. findIndex ( thread => thread . id === threadId ) ?? - 1 ;
21072129 if ( index > - 1 ) {
2108- const thread = parseGraphQLReviewThread ( data . resolveReviewThread . thread , this . githubRepository ) ;
2130+ const thread = parseGraphQLReviewThread ( data . resolveReviewThread . thread , this . githubRepository , this . head ?. sha ) ;
21092131 this . _reviewThreadsCache ?. splice ( index , 1 , thread ) ;
21102132 this . _onDidChangeReviewThreads . fire ( { added : [ ] , changed : [ thread ] , removed : [ ] } ) ;
21112133 }
@@ -2148,7 +2170,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
21482170
21492171 const index = this . _reviewThreadsCache ?. findIndex ( thread => thread . id === threadId ) ?? - 1 ;
21502172 if ( index > - 1 ) {
2151- const thread = parseGraphQLReviewThread ( data . unresolveReviewThread . thread , this . githubRepository ) ;
2173+ const thread = parseGraphQLReviewThread ( data . unresolveReviewThread . thread , this . githubRepository , this . head ?. sha ) ;
21522174 this . _reviewThreadsCache ?. splice ( index , 1 , thread ) ;
21532175 this . _onDidChangeReviewThreads . fire ( { added : [ ] , changed : [ thread ] , removed : [ ] } ) ;
21542176 }
0 commit comments