@@ -132,12 +132,8 @@ class AlertsRootItem extends GitHubTreeItem {
132
132
133
133
for ( const alert of json ) {
134
134
if ( alert . unread && alert . repository . owner . login === 'openjdk' ) {
135
- /*
136
- let alert: NotificationInfo = new NotificationInfo(notification.id, notification.subject.title,
137
- notification.repository.full_name, notification.subject.latest_comment_url,
138
- new Date(notification.updated_at));*/
139
135
const notInfo = new AlertTreeItem ( alert . subject . title , 'alert-' + alert . id ,
140
- alert . subject . latest_comment_url , this . onDidChangeTreeDataEmitter ) ;
136
+ alert . subject . latest_comment_url , alert . subject . url , new Date ( alert . updated_at ) , alert . repository . full_name , this . onDidChangeTreeDataEmitter ) ;
141
137
newAlerts . push ( notInfo ) ;
142
138
}
143
139
}
@@ -151,23 +147,39 @@ class AlertsRootItem extends GitHubTreeItem {
151
147
}
152
148
153
149
class AlertTreeItem extends GitHubTreeItem {
154
- constructor ( label : string , id : string , public commentUrl : string ,
155
- onDidChangeTreeDataEmitter : vscode . EventEmitter < vscode . TreeItem | undefined > ) {
150
+ constructor ( label : string , id : string , private commentUrl : string , private prUrl : string , private updatedAt : Date ,
151
+ private repository : string , onDidChangeTreeDataEmitter : vscode . EventEmitter < vscode . TreeItem | undefined > ) {
156
152
super ( label , id , vscode . TreeItemCollapsibleState . Collapsed , false , 'github-item.svg' , onDidChangeTreeDataEmitter ) ;
157
153
}
158
154
159
155
protected loadChildrenArrayFromWeb ( ) : Promise < GitHubTreeItem [ ] > {
160
156
return GitHubProvider . getGHjson ( this . commentUrl , ( comment : any , resolveJson : any , rejectJson : any ) => {
161
157
const newCommentInfo : GitHubTreeItem [ ] = [ ] ;
162
158
163
- newCommentInfo . push ( new GitHubLeafTreeItem ( 'User: ' + comment . user . login ,
164
- this . commentUrl + '+username' , 'github-item.svg' , this . onDidChangeTreeDataEmitter ) ) ;
159
+ // Stupid cleaning of html tags; will likely work ok since GitHub does the real work for us
160
+ const cleanedComment = comment . body . replace ( / < \/ ? [ ^ > ] + ( > | $ ) / g, '' ) . trim ( ) ;
161
+
162
+ const prNumber = this . prUrl . split ( '/' ) . pop ( ) ;
163
+
164
+ let localeConf = vscode . workspace . getConfiguration ( 'openjdkDevel' ) . get ( 'locale' , '' ) ;
165
+ let locale ;
166
+ if ( localeConf === '' ) {
167
+ locale = undefined ;
168
+ } else {
169
+ locale = localeConf ;
170
+ }
171
+
172
+ newCommentInfo . push ( new GitHubLeafTreeItem ( cleanedComment ,
173
+ this . commentUrl + '+comment' , 'github-conversation.svg' , this . onDidChangeTreeDataEmitter ) ) ;
174
+
175
+ newCommentInfo . push ( new GitHubLeafTreeItem ( comment . user . login ,
176
+ this . commentUrl + '+username' , 'github-user.svg' , this . onDidChangeTreeDataEmitter ) ) ;
165
177
166
- newCommentInfo . push ( new GitHubLeafTreeItem ( 'Comment: ' + comment . html_url ,
167
- this . commentUrl + '+commentUrl ' , 'github-item .svg' , this . onDidChangeTreeDataEmitter ) ) ;
178
+ newCommentInfo . push ( new GitHubLeafTreeItem ( this . updatedAt . toLocaleString ( locale ) ,
179
+ this . commentUrl + '+date ' , 'github-time .svg' , this . onDidChangeTreeDataEmitter ) ) ;
168
180
169
- newCommentInfo . push ( new GitHubLeafTreeItem ( 'Body: ' + comment . body ,
170
- this . commentUrl + '+body ' , 'github-item .svg' , this . onDidChangeTreeDataEmitter ) ) ;
181
+ newCommentInfo . push ( new GitHubLeafTreeItem ( ` ${ this . repository } # ${ prNumber } ` ,
182
+ this . commentUrl + '+pr ' , 'github-pullrequest .svg' , this . onDidChangeTreeDataEmitter ) ) ;
171
183
172
184
resolveJson ( newCommentInfo ) ;
173
185
} ) ;
@@ -230,7 +242,7 @@ class PRTreeItem extends GitHubTreeItem {
230
242
`${ repo } #${ prNumber } by @${ author } ` , 'goto' + id , 'github-conversation.svg' , onDidChangeTreeDataEmitter
231
243
) ;
232
244
this . generated . push ( this . convItem ) ;
233
- // diff must be complemented from prUrl
245
+ // Diff description must be complemented from prUrl, which can only be done later
234
246
this . diffItem = new GitHubLeafTreeItem ( 'Diff' , 'diff' + id , 'github-diff.svg' , onDidChangeTreeDataEmitter ) ;
235
247
this . generated . push ( this . diffItem ) ;
236
248
if ( tags ) {
0 commit comments