Remove unnecessary writes on customer creation

The form only submits enterprise id and email address. We don't need to
assign any other attributes.
This commit is contained in:
Maikel Linke
2023-06-15 11:30:52 +10:00
parent 9bd6615dad
commit a655d3d787

View File

@@ -37,10 +37,9 @@ module Admin
def create
@customer = Customer.find_or_new(customer_params[:email], customer_params[:enterprise_id])
@customer.assign_attributes(customer_params)
if user_can_create_customer?
@customer.set_created_manually_flag
@customer.created_manually = true
if @customer.save
tag_rule_mapping = TagRule.mapping_for(Enterprise.where(id: @customer.enterprise))
render_as_json @customer, tag_rule_mapping: tag_rule_mapping