@@ -125,6 +125,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
125125 score : [ '' , [ Validators . required , Validators . pattern ( '^0*(\.[0-9]+)?$|^1(\.0+)?$' ) ] ] , inboundPattern : [ '' ] ,
126126 constraintPattern : [ '' ] ,
127127 enabled : [ '' ] ,
128+ usesActorEmailId : [ '' ] ,
128129 type : LDN_SERVICE . value ,
129130 } ) ;
130131 }
@@ -178,7 +179,8 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
178179 return rest ;
179180 } ) ;
180181
181- const values = { ...this . formModel . value , enabled : true } ;
182+ const values = { ...this . formModel . value , enabled : true ,
183+ usesActorEmailId : this . formModel . get ( 'usesActorEmailId' ) . value } ;
182184
183185 const ldnServiceData = this . ldnServicesService . create ( values ) ;
184186
@@ -237,6 +239,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
237239 ldnUrl : this . ldnService . ldnUrl ,
238240 type : this . ldnService . type ,
239241 enabled : this . ldnService . enabled ,
242+ usesActorEmailId : this . ldnService . usesActorEmailId ,
240243 lowerIp : this . ldnService . lowerIp ,
241244 upperIp : this . ldnService . upperIp ,
242245 } ) ;
@@ -384,6 +387,32 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
384387 ) ;
385388 }
386389
390+ /**
391+ * Toggles the usesActorEmailId field of the LDN service by sending a patch request
392+ */
393+ toggleUsesActorEmailId ( ) {
394+ const newStatus = ! this . formModel . get ( 'usesActorEmailId' ) . value ;
395+ if ( ! this . isNewService ) {
396+ const patchOperation : Operation = {
397+ op : 'replace' ,
398+ path : '/usesActorEmailId' ,
399+ value : newStatus ,
400+ } ;
401+
402+ this . ldnServicesService . patch ( this . ldnService , [ patchOperation ] ) . pipe (
403+ getFirstCompletedRemoteData ( ) ,
404+ ) . subscribe (
405+ ( ) => {
406+ this . formModel . get ( 'usesActorEmailId' ) . setValue ( newStatus ) ;
407+ this . cdRef . detectChanges ( ) ;
408+ } ,
409+ ) ;
410+ } else {
411+ this . formModel . get ( 'usesActorEmailId' ) . setValue ( newStatus ) ;
412+ this . cdRef . detectChanges ( ) ;
413+ }
414+ }
415+
387416 /**
388417 * Closes the modal
389418 */
0 commit comments