@@ -28,6 +28,7 @@ import isNewResource from 'core-app/features/hal/helpers/is-new-resource';
2828import { PathHelperService } from 'core-app/core/path-helper/path-helper.service' ;
2929import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service' ;
3030import { CurrentProjectService } from 'core-app/core/current-project/current-project.service' ;
31+ import { isSemanticWorkPackageId } from 'core-app/shared/helpers/work-package-id-pattern' ;
3132
3233import { Placement } from '@floating-ui/dom' ;
3334
@@ -123,6 +124,10 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {
123124 this . copyToClipboardService . copy ( url . toString ( ) ) ;
124125 break ;
125126 }
127+ case 'copy_numeric_id_to_clipboard' :
128+ this . copyToClipboardService . copy ( `${ id } ` ) ;
129+ break ;
130+
126131 case 'copy_to_other_project' :
127132 window . location . href = `${ this . pathHelper . staticBase } /work_packages/move/new?copy=true&ids[]=${ id } ` ;
128133 break ;
@@ -212,7 +217,15 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {
212217
213218 protected buildItems ( ) :OpContextMenuItem [ ] {
214219 const selected = this . getSelectedWorkPackages ( ) ;
215- const items = this . permittedActions . map ( ( action :WorkPackageAction ) => ( {
220+
221+ // Copying the numeric ID is only useful in semantic mode, where the
222+ // displayed identifier (e.g. "PROJ-42") is not the numeric ID itself.
223+ const visibleActions = this . permittedActions . filter ( ( action ) => (
224+ action . key !== 'copy_numeric_id_to_clipboard'
225+ || isSemanticWorkPackageId ( this . workPackage . displayId )
226+ ) ) ;
227+
228+ const items = visibleActions . map ( ( action :WorkPackageAction ) => ( {
216229 class : undefined as string | undefined ,
217230 disabled : false ,
218231 linkText : action . text ,
0 commit comments