Skip to content

Commit

Permalink
Update user invite flow (#3111)
Browse files Browse the repository at this point in the history
After preliminary validations and due to some limitations on the DSI public API,
a decision was made to further modify the flow of the user invite process.

Changes proposed in this pull request
* Removes school users list from users#index
* Update user invite flow
* Removes school users list from users#index
* Removes `organisation_users`
* Removes specs for `organisation_users`
  • Loading branch information
ekumachidi authored Mar 27, 2024
1 parent d690d54 commit b699d23
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 149 deletions.
15 changes: 8 additions & 7 deletions app/controllers/schools/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
module Schools
class UsersController < BaseController
def index
@users = DFESignInAPI::OrganisationUsers.new(current_user.sub, current_school.urn).users
@dfe_sign_in_manage_users_url =
Rails.application.config.x.dfe_sign_in_manage_users_url.presence
end
def index; end

def new
@user_invite = DFESignInAPI::UserInvite.new
Expand All @@ -16,8 +12,13 @@ def create

if params[:confirmed] == 'true'
if @user_invite.valid?
@user_invite.create
redirect_to schools_users_path, notice: "#{@user_invite.email} has been added."
begin
@user_invite.create
redirect_to schools_users_path, notice: "#{@user_invite.email} has been added."
rescue StandardError
flash.notice = "An error occurred while adding #{@user_invite.email}"
render :show, locals: { user_invite: @user_invite }
end
else
render :new
end
Expand Down
29 changes: 0 additions & 29 deletions app/services/schools/dfe_sign_in_api/organisation_users.rb

This file was deleted.

4 changes: 2 additions & 2 deletions app/views/schools/dashboards/_profile_and_dates.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<h2 class="govuk-heading-m"><%= @current_school.name %></h2>
<ul class="govuk-list">
<li>
<%= link_to "Update school profile", schools_on_boarding_profile_path %>
<%= link_to "Add new users", schools_users_path %>
</li>
<li>
<%= link_to "Manage users", schools_users_path %>
<%= link_to "Update school profile", schools_on_boarding_profile_path %>
</li>
</ul>
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
Expand Down
40 changes: 5 additions & 35 deletions app/views/schools/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<h1>Manage users at <%= @current_school.name %> </h1>
<%= link_to 'Add user', new_schools_user_path, class: 'govuk-button' %>
<h1>Add users to <%= @current_school.name %> </h1>

<p>
Users will be able to:
Expand All @@ -21,40 +20,11 @@
<li>add other users from your school</li>
</ul>
</p>
<p> To remove and manage users, you should go to
<%= link_to 'DFE Sign-in', @dfe_sign_in_manage_users_url %>
</p>

<% if @users.any? %>
<div class="pagination-info higher">
<div class="pagination-slice">
</div>
</div>
<table id="invited-users" class="govuk-table">
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header">Name</th>
<th class="govuk-table__header">Email</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<% @users.each do |user| %>
<tr class="govuk-table__row">
<td class="govuk-table__cell"><%= "#{user['firstName']} #{user['lastName']}" %></td>
<td class="govuk-table__cell"><%= user['email'] %></td>
</tr>
<% end %>

</tbody>
</table>
<div class="pagination-info lower">
</div>
<% else %>
<p>
There are no other users in this school.
</p>
<% end %>
<div>
<%= govuk_link_to 'Add user', new_schools_user_path, primary: true %>
<%= govuk_link_to "Return to dashboard", schools_dashboard_path, secondary: true %>
</div>

<%= govuk_link_to "Return to dashboard", schools_dashboard_path, secondary: true %>
</div>
</div>
76 changes: 0 additions & 76 deletions spec/services/schools/dfe_sign_in_api/organisation_users_spec.rb

This file was deleted.

0 comments on commit b699d23

Please sign in to comment.