@@ -102,28 +102,43 @@ export class NotificationsFeatureRegister extends Disposable {
102102 ) ;
103103 this . _register (
104104 vscode . commands . registerCommand ( 'notification.markAsRead' , ( options : any ) => {
105- let threadId : string ;
106- let notificationKey : string ;
107- if ( isNotificationTreeItem ( options ) ) {
108- threadId = options . notification . id ;
109- notificationKey = options . notification . key ;
110- } else if ( 'threadId' in options && 'notificationKey' in options && typeof options . threadId === 'number' && typeof options . notificationKey === 'string' ) {
111- threadId = options . threadId ;
112- notificationKey = options . notificationKey ;
113- } else {
114- throw new Error ( `Invalid arguments for command notification.markAsRead : ${ JSON . stringify ( options ) } ` ) ;
115- }
105+ const { threadId, notificationKey } = this . _extractMarkAsCommandOptions ( options ) ;
116106 /* __GDPR__
117107 "notification.markAsRead" : {}
118108 */
119109 this . _telemetry . sendTelemetryEvent ( 'notification.markAsRead' ) ;
120110 notificationsManager . markAsRead ( { threadId, notificationKey } ) ;
121111 } )
122112 ) ;
113+ this . _register (
114+ vscode . commands . registerCommand ( 'notification.markAsDone' , ( options : any ) => {
115+ const { threadId, notificationKey } = this . _extractMarkAsCommandOptions ( options ) ;
116+ /* __GDPR__
117+ "notification.markAsDone" : {}
118+ */
119+ this . _telemetry . sendTelemetryEvent ( 'notification.markAsDone' ) ;
120+ notificationsManager . markAsDone ( { threadId, notificationKey } ) ;
121+ } )
122+ ) ;
123123
124124 // Events
125125 this . _register ( onceEvent ( this . _repositoriesManager . onDidLoadAnyRepositories ) ( ( ) => {
126126 notificationsManager . refresh ( ) ;
127127 } ) ) ;
128128 }
129+
130+ private _extractMarkAsCommandOptions ( options : any ) : { threadId : string , notificationKey : string } {
131+ let threadId : string ;
132+ let notificationKey : string ;
133+ if ( isNotificationTreeItem ( options ) ) {
134+ threadId = options . notification . id ;
135+ notificationKey = options . notification . key ;
136+ } else if ( 'threadId' in options && 'notificationKey' in options && typeof options . threadId === 'number' && typeof options . notificationKey === 'string' ) {
137+ threadId = options . threadId ;
138+ notificationKey = options . notificationKey ;
139+ } else {
140+ throw new Error ( `Invalid arguments for command notification.markAsRead : ${ JSON . stringify ( options ) } ` ) ;
141+ }
142+ return { threadId, notificationKey } ;
143+ }
129144}
0 commit comments