Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify users about invites to MSE #3106

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion app/controllers/schools/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Schools
class UsersController < BaseController
def index
@users = DFESignInAPI::OrganisationUsers.new(current_user.sub, current_school.urn).users
@users = DFESignInAPI::OrganisationUsers.new(current_user.sub, current_school.urn).users_as_invite_objects
@dfe_sign_in_manage_users_url =
Rails.application.config.x.dfe_sign_in_manage_users_url.presence
end
Expand Down
14 changes: 14 additions & 0 deletions app/services/schools/dfe_sign_in_api/organisation_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ def ukprn

def users
response&.fetch('users', nil)
# users_as_invite_objects
end

def users_as_invite_objects
return [] if users.blank?

users.map do |user_data|
Schools::DFESignInAPI::UserInvite.new(
email: user_data['email'],
firstname: user_data['firstName'],
lastname: user_data['lastName'],
organisation_id: current_school_urn
)
end
end

private
Expand Down
7 changes: 5 additions & 2 deletions app/views/schools/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
<% if @users.any? %>
<div class="pagination-info higher">
<div class="pagination-slice">
<%= page_entries_info @users %>
</div>
<%= paginate @users %>
</div>
<table id="invited-users" class="govuk-table">
<thead class="govuk-table__head">
Expand All @@ -40,14 +42,15 @@
<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>
<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">
<%= paginate @users %>
</div>
<% else %>
<p>
Expand Down
Loading