From 455bf93c81cec6ce49719e05fca2ce5cee849875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 4 Nov 2026 16:08:22 +0400 Subject: [PATCH] Link dashboard Storage card to connected apps when present Users with stored remoteStorage authorizations now jump straight to the connected apps dashboard from the services dashboard, instead of the storage info page. --- app/controllers/dashboard_controller.rb | 6 ++++++ app/views/dashboard/index.html.erb | 2 +- spec/features/dashboard_spec.rb | 26 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 3f9c14e..56643d1 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -3,5 +3,11 @@ class DashboardController < ApplicationController def index @current_section = :services + @storage_path = + if Setting.remotestorage_enabled? && current_user.remote_storage_authorizations.exists? + apps_services_storage_path + else + services_storage_path + end end end diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 3c97380..1d4c741 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -47,7 +47,7 @@
- <%= link_to services_storage_path, + <%= link_to @storage_path, class: "block h-full px-6 py-6 rounded-md btn-text-dark" do %>

Storage

diff --git a/spec/features/dashboard_spec.rb b/spec/features/dashboard_spec.rb index a23e540..a511b72 100644 --- a/spec/features/dashboard_spec.rb +++ b/spec/features/dashboard_spec.rb @@ -11,4 +11,30 @@ RSpec.describe 'Account dashboard', type: :feature do visit root_path expect(page).to have_content('Services') end + + context 'with connected remoteStorage apps' do + before do + allow_any_instance_of(AppCatalog::WebApp).to receive(:update_metadata).and_return(true) + allow_any_instance_of(RemoteStorageAuthorization).to receive(:remove_token_expiry_job).and_return(nil) + + user.remote_storage_authorizations.create!( + permissions: ["documents:rw"], + client_id: "app.example.com", + redirect_uri: "https://app.example.com", + expire_at: 1.month.from_now + ) + end + + scenario 'links the Storage card to the connected apps dashboard' do + visit root_path + expect(page).to have_link('Storage', href: apps_services_storage_path) + end + end + + context 'without connected remoteStorage apps' do + scenario 'links the Storage card to the storage info page' do + visit root_path + expect(page).to have_link('Storage', href: services_storage_path) + end + end end