File tree Expand file tree Collapse file tree 4 files changed +9
-12
lines changed
Expand file tree Collapse file tree 4 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -919,9 +919,8 @@ export function registerCommands(
919919
920920 context . subscriptions . push (
921921 vscode . commands . registerCommand ( 'pr.markAllCopilotNotificationsAsRead' , node => {
922- if ( node instanceof CategoryTreeNode && node . isCopilot && node . folderRepoManager . gitHubRepositories . length > 0 ) {
923- const repo = node . folderRepoManager . gitHubRepositories [ 0 ] ;
924- copilotRemoteAgentManager . clearAllNotifications ( repo . remote . owner , repo . remote . repositoryName ) ;
922+ if ( node instanceof CategoryTreeNode && node . isCopilot && node . repo ) {
923+ copilotRemoteAgentManager . clearAllNotifications ( node . repo . owner , node . repo . repositoryName ) ;
925924 tree . refresh ( node ) ;
926925 }
927926 } ) ,
Original file line number Diff line number Diff line change @@ -114,8 +114,9 @@ export class CopilotStateModel extends Disposable {
114114 // If owner and repo are specified, only clear notifications for that repo
115115 if ( owner && repo ) {
116116 const keysToRemove : string [ ] = [ ] ;
117+ const prefix = `${ this . makeKey ( owner , repo ) } #` ;
117118 for ( const key of this . _showNotification . keys ( ) ) {
118- if ( key . startsWith ( ` ${ owner } / ${ repo } #` ) ) {
119+ if ( key . startsWith ( prefix ) ) {
119120 const item = this . _states . get ( key ) ?. item ;
120121 if ( item ) {
121122 items . push ( item ) ;
Original file line number Diff line number Diff line change @@ -880,14 +880,7 @@ export class CopilotRemoteAgentManager extends Disposable {
880880 }
881881
882882 getNotificationsCountForRepo ( owner : string , repo : string ) : number {
883- let count = 0 ;
884- const prefix = `${ owner } /${ repo } #` ;
885- for ( const key of this . _stateModel . notifications . keys ( ) ) {
886- if ( key . startsWith ( prefix ) ) {
887- count ++ ;
888- }
889- }
890- return count ;
883+ return this . _stateModel . getNotificationsCount ( owner , repo ) ;
891884 }
892885
893886 public clearAllNotifications ( owner ?: string , repo ?: string ) : void {
Original file line number Diff line number Diff line change @@ -195,6 +195,10 @@ export class CategoryTreeNode extends TreeNode implements vscode.TreeItem {
195195 }
196196 }
197197
198+ get repo ( ) : RemoteInfo | undefined {
199+ return this . _repo ;
200+ }
201+
198202 private _getDescription ( ) : string | undefined {
199203 if ( ! this . isCopilot || ! this . _repo ) {
200204 return undefined ;
You can’t perform that action at this time.
0 commit comments