Skip to content

Commit

Permalink
Test params assignment and redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
ekumachidi committed Mar 10, 2024
1 parent 34010a2 commit 9ea473a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
7 changes: 3 additions & 4 deletions app/controllers/schools/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ def new

def create
@user_invite = DFESignInAPI::UserInvite.new(user_params)
# @user_invite.organisation_id = DFESignInAPI::Organisation.new(current_user.sub, current_school.urn).current_organisation_id
# redirect_to root_path
# @user_invite.organisation_id = DFESignInAPI::Organisation.new(current_user.sub,
# current_school.urn).current_organisation_id

if params[:confirmed] == 'true'
if @user_invite.valid?
Expand All @@ -29,14 +28,14 @@ def create
end

def show
@user_invite = DFESignInAPI::UserInvite.new(user_params)
# @user_invite = DFESignInAPI::UserInvite.new(user_params)
render :show
end

private

def user_params
params.require(:user_invite).permit(:email, :firstname, :lastname, :organisation_id)
params.require(:schools_dfe_sign_in_api_user_invite).permit(:email, :firstname, :lastname, :organisation_id)
end
end
end
6 changes: 0 additions & 6 deletions app/services/schools/dfe_sign_in_api/user_invite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ def invite_user
@response ||= response
end

def full_name
return nil unless first_name && last_name

[firstname, lastname].map(&:presence).join(' ')
end

private

def response
Expand Down
6 changes: 3 additions & 3 deletions app/views/schools/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
First name
</dt>
<dd class="govuk-summary-list__value">
<%= @user.firstname %>
<%= @user_invite.firstname %>
</dd>
</div>

Expand All @@ -23,7 +23,7 @@
Last name
</dt>
<dd class="govuk-summary-list__value">
<%= @user.lastname %>
<%= @user_invite.lastname %>
</dd>
</div>

Expand All @@ -32,7 +32,7 @@
Email address
</dt>
<dd class="govuk-summary-list__value">
<%= @user.email %>
<%= @user_invite.email %>
</dd>
</div>
<%= hidden_field_tag :confirmed, true %>
Expand Down

0 comments on commit 9ea473a

Please sign in to comment.