@@ -383,7 +383,7 @@ export async function listStewardshipActivity(
383383 actorUserId : row . actorUserId ,
384384 actorType : row . actorType ,
385385 activityType : row . activityType ,
386- content : row . content ,
386+ content : translateActivityContent ( row . content ) ,
387387 metadata : row . metadata as Record < string , unknown > | null ,
388388 stewardshipStatus : row . stewardshipStatus ,
389389 createdAt : toIso ( row . createdAt ) ,
@@ -424,7 +424,7 @@ export async function listPackageHistory(
424424 actorUserId : r . actorUserId ? String ( r . actorUserId ) : null ,
425425 actorType : String ( r . actorType ) ,
426426 activityType : String ( r . activityType ) ,
427- content : r . content ? String ( r . content ) : null ,
427+ content : translateActivityContent ( r . content ? String ( r . content ) : null ) ,
428428 metadata : r . metadata as Record < string , unknown > | null ,
429429 createdAt : toIso ( r . createdAt ) ,
430430 } ) )
@@ -450,6 +450,14 @@ export const ESCALATION_RESOLUTION_PATH_LABELS: Record<EscalationResolutionPath,
450450 namespace_takeover : 'Namespace Takeover' ,
451451}
452452
453+ function translateActivityContent ( content : string | null ) : string | null {
454+ if ( ! content ) return content
455+ return content . replace ( / ^ ( E s c a l a t e d w i t h r e s o l u t i o n p a t h : ) ( \S + ) $ / , ( _ , prefix , key ) => {
456+ const label = ESCALATION_RESOLUTION_PATH_LABELS [ key as EscalationResolutionPath ]
457+ return label ? `${ prefix } ${ label } ` : content
458+ } )
459+ }
460+
453461/**
454462 * Escalates a stewardship. Updates status to 'escalated' and logs the
455463 * chosen resolution path in stewardship_activity metadata.
@@ -487,7 +495,7 @@ export async function escalateStewardship(
487495 resolutionPath : data . resolutionPath ,
488496 statusNote : data . notes ?? null ,
489497 actorUserId : data . actorUserId ,
490- content : `Escalated with resolution path: ${ ESCALATION_RESOLUTION_PATH_LABELS [ data . resolutionPath ] } ` ,
498+ content : `Escalated with resolution path: ${ data . resolutionPath } ` ,
491499 metadata : JSON . stringify ( {
492500 resolutionPath : data . resolutionPath ,
493501 ...( data . notes ? { notes : data . notes } : { } ) ,
0 commit comments