Skip to content

Commit

Permalink
Merge pull request #911 from frab/missing_translated_for_shared_perso…
Browse files Browse the repository at this point in the history
…n_form

Missing permitted params for shared person form
  • Loading branch information
manno committed Oct 20, 2022
2 parents 3b08ee6 + cbee83f commit 32008a7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
7 changes: 7 additions & 0 deletions app/controllers/application_controller.rb
Expand Up @@ -37,6 +37,13 @@ def set_locale
end
end

def translated_person_params
# Person can be edited without a conference, so allow all languages
translated_params = Language.all_normalized.map { |l|
[:"abstract_#{l}", :"description_#{l}"]
}.flatten
end

def load_conference
@conference = conference_from_params
@conference ||= conference_from_session
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/cfp/people_controller.rb
Expand Up @@ -106,7 +106,9 @@ def update

def person_params
params.require(:person).permit(
:first_name, :last_name, :public_name, :email, :email_public, :gender, :avatar, :abstract, :description, :include_in_mailings,
:first_name, :last_name, :public_name, :email, :email_public, :gender, :avatar,
:include_in_mailings,
*translated_person_params,
im_accounts_attributes: %i(id im_type im_address _destroy),
languages_attributes: %i(id code _destroy),
links_attributes: %i(id title url _destroy),
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/crew_profiles_controller.rb
Expand Up @@ -20,7 +20,9 @@ def update

def person_params
params.require(:person).permit(
:first_name, :last_name, :public_name, :email, :email_public, :gender, :avatar, :abstract, :description, :include_in_mailings, :note,
:first_name, :last_name, :public_name, :email, :email_public, :gender, :avatar,
:include_in_mailings, :note,
*translated_person_params,
im_accounts_attributes: %i(id im_type im_address _destroy),
languages_attributes: %i(id code _destroy),
links_attributes: %i(id title url _destroy),
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/people_controller.rb
Expand Up @@ -153,15 +153,10 @@ def search(people, search_by_id = false)
end

def person_params
# Person can be edited without a conference, so allow all languages
translated_params = Language.all_normalized.map { |l|
[:"abstract_#{l}", :"description_#{l}"]
}.flatten

params.require(:person).permit(
:first_name, :last_name, :public_name, :email, :email_public, :gender, :avatar,
:include_in_mailings, :note,
*translated_params,
*translated_person_params,
im_accounts_attributes: %i(id im_type im_address _destroy),
languages_attributes: %i(id code _destroy),
links_attributes: %i(id title url _destroy),
Expand Down

0 comments on commit 32008a7

Please sign in to comment.