@@ -187,47 +187,28 @@ export class ExtHostComments implements ExtHostCommentsShape, IDisposable {
187187 } ) . then ( ranges => ranges ? ranges . map ( x => extHostTypeConverter . Range . from ( x ) ) : undefined ) ;
188188 }
189189
190- $provideReactionGroup ( commentControllerHandle : number ) : Promise < modes . CommentReaction [ ] | undefined > {
191- const commentController = this . _commentControllers . get ( commentControllerHandle ) ;
192-
193- if ( ! commentController || ! commentController . reactionProvider ) {
194- return Promise . resolve ( undefined ) ;
195- }
196-
197- return asPromise ( ( ) => {
198- return commentController ! . reactionProvider ! . availableReactions ;
199- } ) . then ( reactions => reactions . map ( reaction => convertToReaction ( commentController . reactionProvider , reaction ) ) ) ;
200- }
201-
202190 $toggleReaction ( commentControllerHandle : number , threadHandle : number , uri : UriComponents , comment : modes . Comment , reaction : modes . CommentReaction ) : Promise < void > {
203- const document = this . _documents . getDocument ( URI . revive ( uri ) ) ;
204191 const commentController = this . _commentControllers . get ( commentControllerHandle ) ;
205192
206- if ( ! commentController || ! ( ( commentController . reactionProvider && commentController . reactionProvider . toggleReaction ) || commentController . reactionHandler ) ) {
193+ if ( ! commentController || commentController . reactionHandler ) {
207194 return Promise . resolve ( undefined ) ;
208195 }
209196
210197 return asPromise ( ( ) => {
211198 const commentThread = commentController . getCommentThread ( threadHandle ) ;
212199 if ( commentThread ) {
213- const vscodeComment = commentThread . getComment ( comment . commentId ) ;
200+ const vscodeComment = commentThread . getCommentByUniqueId ( comment . uniqueIdInThread ) ;
214201
215202 if ( commentController !== undefined && vscodeComment ) {
216203 if ( commentController . reactionHandler ) {
217204 return commentController . reactionHandler ( vscodeComment , convertFromReaction ( reaction ) ) ;
218205 }
219-
220- if ( commentController . reactionProvider && commentController . reactionProvider . toggleReaction ) {
221- return commentController . reactionProvider . toggleReaction ( document , vscodeComment , convertFromReaction ( reaction ) ) ;
222- }
223206 }
224-
225207 }
226208
227209 return Promise . resolve ( undefined ) ;
228210 } ) ;
229211 }
230-
231212 dispose ( ) {
232213
233214 }
@@ -391,16 +372,6 @@ export class ExtHostCommentThread implements vscode.CommentThread {
391372 ) ;
392373 }
393374
394- getComment ( commentId : string ) : vscode . Comment | undefined {
395- const comments = this . _comments . filter ( comment => comment . commentId === commentId ) ;
396-
397- if ( comments && comments . length ) {
398- return comments [ 0 ] ;
399- }
400-
401- return undefined ;
402- }
403-
404375 getCommentByUniqueId ( uniqueId : number ) : vscode . Comment | undefined {
405376 for ( let key of this . _commentsMap ) {
406377 let comment = key [ 0 ] ;
@@ -442,19 +413,6 @@ class ExtHostCommentController implements vscode.CommentController {
442413 private _threads : Map < number , ExtHostCommentThread > = new Map < number , ExtHostCommentThread > ( ) ;
443414 commentingRangeProvider ?: vscode . CommentingRangeProvider ;
444415
445- private _commentReactionProvider ?: vscode . CommentReactionProvider ;
446-
447- get reactionProvider ( ) : vscode . CommentReactionProvider | undefined {
448- return this . _commentReactionProvider ;
449- }
450-
451- set reactionProvider ( provider : vscode . CommentReactionProvider | undefined ) {
452- this . _commentReactionProvider = provider ;
453- if ( provider ) {
454- this . _proxy . $updateCommentControllerFeatures ( this . handle , { reactionGroup : provider . availableReactions . map ( reaction => convertToReaction ( provider , reaction ) ) } ) ;
455- }
456- }
457-
458416 private _reactionHandler ?: ReactionHandler ;
459417
460418 get reactionHandler ( ) : ReactionHandler | undefined {
@@ -537,25 +495,23 @@ function convertToModeComment(thread: ExtHostCommentThread, commentController: E
537495 const iconPath = vscodeComment . author && vscodeComment . author . iconPath ? vscodeComment . author . iconPath . toString ( ) : undefined ;
538496
539497 return {
540- commentId : vscodeComment . commentId ,
541498 mode : vscodeComment . mode ,
542499 contextValue : vscodeComment . contextValue ,
543500 uniqueIdInThread : commentUniqueId ,
544501 body : extHostTypeConverter . MarkdownString . from ( vscodeComment . body ) ,
545502 userName : vscodeComment . author . name ,
546503 userIconPath : iconPath ,
547504 label : vscodeComment . label ,
548- commentReactions : vscodeComment . reactions ? vscodeComment . reactions . map ( reaction => convertToReaction ( commentController . reactionProvider , reaction ) ) : undefined
505+ commentReactions : vscodeComment . reactions ? vscodeComment . reactions . map ( reaction => convertToReaction ( reaction ) ) : undefined
549506 } ;
550507}
551508
552- function convertToReaction ( provider : vscode . CommentReactionProvider | undefined , reaction : vscode . CommentReaction ) : modes . CommentReaction {
509+ function convertToReaction ( reaction : vscode . CommentReaction ) : modes . CommentReaction {
553510 return {
554511 label : reaction . label ,
555512 iconPath : reaction . iconPath ? extHostTypeConverter . pathOrURIToURI ( reaction . iconPath ) : undefined ,
556513 count : reaction . count ,
557- hasReacted : reaction . hasReacted ,
558- canEdit : provider !== undefined ? ! ! provider . toggleReaction : false
514+ hasReacted : reaction . authorHasReacted ,
559515 } ;
560516}
561517
@@ -564,7 +520,6 @@ function convertFromReaction(reaction: modes.CommentReaction): vscode.CommentRea
564520 label : reaction . label || '' ,
565521 count : reaction . count || 0 ,
566522 iconPath : reaction . iconPath ? URI . revive ( reaction . iconPath ) : '' ,
567- hasReacted : reaction . hasReacted ,
568523 authorHasReacted : reaction . hasReacted || false
569524 } ;
570525}
0 commit comments