Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/controllers/concerns/org_selectable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ module OrgSelectable

# Converts the incoming params_into an Org by either locating it
# via its id, identifier and/or name, or initializing a new one
def org_from_params(params_in:, allow_create: true)
# the default allow_create is based off restrict_orgs
def org_from_params(params_in:,
allow_create: !Rails.configuration.x.application.restrict_orgs)
# params_in = params_in.with_indifferent_access
return nil unless params_in[:org_id].present? &&
params_in[:org_id].is_a?(String)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def update
# appropriate namespace, so org_id represents our funder
funder_attrs = plan_params[:funder]
funder_attrs[:org_id] = plan_params[:funder][:id]
funder = org_from_params(params_in: funder_attrs, allow_create: true)
funder = org_from_params(params_in: funder_attrs)
@plan.funder_id = funder&.id
attrs.delete(:funder)

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def update_params
def handle_org(attrs:)
return attrs unless attrs.present? && attrs[:org_id].present?

org = org_from_params(params_in: attrs, allow_create: true)
org = org_from_params(params_in: attrs)

# Remove the extraneous Org Selector hidden fields
attrs = remove_org_selection_params(params_in: attrs)
Expand Down