Skip to content

Commit

Permalink
Remove redundant RootController code
Browse files Browse the repository at this point in the history
In 8ad9b99, I removed `UserPermissionsControllerMethods`, which is where
this code previously lived, since this was the only place it was being
used. However, it looks like we don't even use the permissions, so we
can just pass down the applications that we get in a previous line

Co-authored-by: Bruce Bolt <[email protected]>
Co-authored-by: Callum Knights
<[email protected]>
Co-authored-by: George Eaton <[email protected]>
Co-authored-by: Jon Hallam <[email protected]>
  • Loading branch information
4 people committed Aug 13, 2024
1 parent 44519de commit ba4ae00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions app/controllers/root_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ class RootController < ApplicationController
skip_after_action :verify_authorized

def index
applications = Doorkeeper::Application.not_api_only.with_home_uri.can_signin(current_user)

@applications_and_permissions = applications.map do |application|
[application, current_user.application_permissions.where(application_id: application.id)]
end
@applications = Doorkeeper::Application.not_api_only.with_home_uri.can_signin(current_user)
end

def signin_required
Expand Down
4 changes: 2 additions & 2 deletions app/views/root/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
} %>
<% end %>

<% if @applications_and_permissions.empty? %>
<% if @applications.empty? %>
<p class="govuk-body">
You haven’t been assigned to any applications yet
</p>
<% end %>

<% @applications_and_permissions.each do |application, permissions| %>
<% @applications.each do |application| %>
<div class="app-application-list__item">
<h3 class="govuk-heading-m govuk-!-margin-bottom-1">
<%= link_to application.name, application.home_uri, class: "govuk-link" %>
Expand Down

0 comments on commit ba4ae00

Please sign in to comment.