@@ -325,17 +325,18 @@ class AzureDevOpsService {
325
325
326
326
// Filter for work item link relations (exclude attachments and hyperlinks)
327
327
const linkRelations = workItem . relations . filter (
328
- ( relation : any ) => relation . rel . includes ( 'Link' ) &&
328
+ ( relation : any ) =>
329
+ relation . rel . includes ( 'Link' ) &&
329
330
relation . rel !== 'AttachedFile' &&
330
331
relation . rel !== 'Hyperlink'
331
332
) ;
332
333
333
334
// Group relations by relationship type
334
335
const groupedRelations : Record < string , WorkItemLink [ ] > = { } ;
335
-
336
+
336
337
linkRelations . forEach ( ( relation : any ) => {
337
338
const relType = relation . rel ;
338
-
339
+
339
340
// Extract work item ID from URL
340
341
// URL format is typically like: https://dev.azure.com/{org}/{project}/_apis/wit/workItems/{id}
341
342
let targetId = 0 ;
@@ -345,17 +346,17 @@ class AzureDevOpsService {
345
346
} catch ( error ) {
346
347
console . error ( 'Failed to extract work item ID from URL:' , relation . url ) ;
347
348
}
348
-
349
+
349
350
if ( ! groupedRelations [ relType ] ) {
350
351
groupedRelations [ relType ] = [ ] ;
351
352
}
352
-
353
+
353
354
const workItemLink : WorkItemLink = {
354
355
...relation ,
355
356
targetId,
356
- title : relation . attributes ?. name || `Work Item ${ targetId } `
357
+ title : relation . attributes ?. name || `Work Item ${ targetId } ` ,
357
358
} ;
358
-
359
+
359
360
groupedRelations [ relType ] . push ( workItemLink ) ;
360
361
} ) ;
361
362
@@ -376,23 +377,23 @@ class AzureDevOpsService {
376
377
377
378
// First get all links
378
379
const linkGroups = await this . getWorkItemLinks ( workItemId ) ;
379
-
380
+
380
381
// Extract all target IDs from all link groups
381
382
const linkedIds : number [ ] = [ ] ;
382
-
383
+
383
384
Object . values ( linkGroups ) . forEach ( links => {
384
385
links . forEach ( link => {
385
386
if ( link . targetId > 0 ) {
386
387
linkedIds . push ( link . targetId ) ;
387
388
}
388
389
} ) ;
389
390
} ) ;
390
-
391
+
391
392
// If no linked items found, return empty array
392
393
if ( linkedIds . length === 0 ) {
393
394
return [ ] ;
394
395
}
395
-
396
+
396
397
// Get the full work item details for all linked items
397
398
const linkedWorkItems = await this . getWorkItems ( linkedIds ) ;
398
399
return linkedWorkItems ;
0 commit comments