diff --git a/api-admin/src/main/java/bio/terra/pearl/api/admin/service/notifications/TriggerExtService.java b/api-admin/src/main/java/bio/terra/pearl/api/admin/service/notifications/TriggerExtService.java index baac4c677b..42022009ac 100644 --- a/api-admin/src/main/java/bio/terra/pearl/api/admin/service/notifications/TriggerExtService.java +++ b/api-admin/src/main/java/bio/terra/pearl/api/admin/service/notifications/TriggerExtService.java @@ -125,6 +125,9 @@ public Trigger replace(PortalStudyEnvAuthContext authContext, UUID configId, Tri Trigger existing = triggerService.find(configId).get(); verifyTrigger(authContext, existing); + if (!existing.isActive()) { + throw new IllegalArgumentException("Cannot edit inactive trigger"); + } Trigger newConfig = create(update, authContext.getStudyEnvironment(), portalEnvironment); // after creating the new config, deactivate the old config @@ -186,6 +189,10 @@ private void verifyTrigger(PortalStudyEnvAuthContext authContext, Trigger config private Trigger create( Trigger newConfig, StudyEnvironment studyEnvironment, PortalEnvironment portalEnvironment) { + if (!newConfig.isActive()) { + throw new IllegalArgumentException("Cannot create inactive trigger"); + } + newConfig.cleanForCopying(); newConfig.setStudyEnvironmentId(studyEnvironment.getId()); newConfig.setPortalEnvironmentId(portalEnvironment.getId()); diff --git a/ui-admin/src/study/notifications/TriggerDesigner.tsx b/ui-admin/src/study/notifications/TriggerDesigner.tsx index e09e0d9f54..0621b77313 100644 --- a/ui-admin/src/study/notifications/TriggerDesigner.tsx +++ b/ui-admin/src/study/notifications/TriggerDesigner.tsx @@ -84,6 +84,10 @@ export const TriggerDesigner = ( } return