From ba4ae009eed9c7e21523b8b230b93016815fe351 Mon Sep 17 00:00:00 2001 From: Ynda Jas Date: Tue, 13 Aug 2024 15:43:12 +0100 Subject: [PATCH] Remove redundant RootController code 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 Co-authored-by: Callum Knights Co-authored-by: George Eaton Co-authored-by: Jon Hallam --- app/controllers/root_controller.rb | 6 +----- app/views/root/index.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 10db54621e..3133c36f75 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -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 diff --git a/app/views/root/index.html.erb b/app/views/root/index.html.erb index 54b65f5e5a..b57cb41c75 100644 --- a/app/views/root/index.html.erb +++ b/app/views/root/index.html.erb @@ -35,13 +35,13 @@ } %> <% end %> - <% if @applications_and_permissions.empty? %> + <% if @applications.empty? %>

You haven’t been assigned to any applications yet

<% end %> - <% @applications_and_permissions.each do |application, permissions| %> + <% @applications.each do |application| %>

<%= link_to application.name, application.home_uri, class: "govuk-link" %>