Commit 2673fb39 authored by Eric Windham's avatar Eric Windham

fixed submitter email issues

parent 1e14d083
/**
* When we init a save action, listen for form changes
*
* @package Ninja Forms builder
* @subpackage Main App
* @copyright (c) 2017 WP Ninjas
* @since 3.1.7
*/
define( [], function( settingCollection ) {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'actions-save' ), 'init:actionModel', this.initSave );
},
/**
* Set listeners up to listen for add/delete fields for Save action
*/
initSave: function( actionModel ) {
this.model = actionModel;
/*
* When we init a save action model, register a listener for new
* fields
*/
this.listenTo( Backbone.Radio.channel( 'fields' ), 'add:field',
this.checkFieldAdded );
/*
* When we init a save action model, register a listener for deleted
* fields
*/
this.listenTo( Backbone.Radio.channel( 'fields' ), 'deleteFields',
this.checkFieldDeleted );
},
/**
* When a save action is init'd, check to see if a new field added
* is an email and decide if it needs to be the 'submitter_email'
* for privacy regulation functionality
*
* @param {backbone.model} actionModel
* @return {void}
*/
checkFieldAdded: function( newFieldModel ) {
if( 'email' == newFieldModel.get( 'type' ) ) {
var submitter_email = this.model.get('submitter_email');
if( '' === submitter_email ) {
this.model.set( 'submitter_email', newFieldModel.get( 'key' ) );
}
}
},
/**
* When a save action is init'd, check to see if a field that has been
* deleted is an email and rearrance the submitter email setting
* for privacy regulation functionality
*
* @param {backbone.model} actionModel
* @return {void}
*/
checkFieldDeleted: function( fieldModel ) {
var submitter_email = this.model.get( 'submitter_email' );
if( submitter_email == fieldModel.get( 'key' ) ) {
this.model.set( 'submitter_email', '' );
}
},
});
return controller;
} );
\ No newline at end of file
......@@ -101,6 +101,7 @@ define(
'controllers/actions/collectPaymentCalculations',
'controllers/actions/collectPaymentFixed',
'controllers/actions/collectPayment',
'controllers/actions/save',
/*
* TODO: Settings domain controllers
......@@ -205,6 +206,7 @@ define(
ActionCollectPaymentCalculations,
ActionCollectPaymentFixed,
ActionCollectPayment,
ActionSave,
/*
* TODO: Settings domain controllers
......@@ -297,7 +299,8 @@ define(
new ActionNewsletterList();
new ActionDeleteFieldListener();
new ActionCollectPaymentCalculations();
new ActionCollectPayment();
new ActionCollectPayment();
new ActionSave();
new ActionTypes();
new ActionData();
new ActionSettings();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,7 +12,8 @@ return apply_filters( 'ninja_forms_action_email_settings', array(
'group' => 'primary',
'label' => __( 'Designated Submitter\'s Email Address', 'ninja-forms' ),
'value' => '',
'help' => __( 'This field helps you with privacy regulations.', 'ninja-forms' ),
'help' => __( 'The email address used in this field will be allowed to '
. 'make data export and delete requests on behalf of their form submission.', 'ninja-forms' ),
),
'fields_save_toggle' => array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment