OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Bug/52676 Do not render oauth access grant modal when the project storage no longer exists (#14747)
Kabiru Mwenja81b2139463eb
diff --git a/app/controllers/oauth_clients_controller.rb b/app/controllers/oauth_clients_controller.rbindex 13ea60f5917..b0458a7d27f 100644--- a/app/controllers/oauth_clients_controller.rb+++ b/app/controllers/oauth_clients_controller.rb@@ -54,7 +54,7 @@ class OAuthClientsController < ApplicationControllerservice_result = @connection_manager.code_to_token(@code)if service_result.success?- flash[:modal] = session[:oauth_callback_flash_modal] if session[:oauth_callback_flash_modal].present?+ flash[:modal] = session.delete(:oauth_callback_flash_modal) if session[:oauth_callback_flash_modal].present?# Redirect the user to the page that initially wanted to access the OAuth2 resource.# "state" is a nonce that identifies a cookie which holds that page's URL.redirect_to @redirect_uridiff --git a/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rb b/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rbindex 17d1604f287..73ede117dec 100644--- a/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rb+++ b/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rb@@ -38,10 +38,14 @@ module Storages::Adminattr_reader :project_storagedef initialize(project_storage_id:, **options)- @project_storage = ::Storages::ProjectStorage.find(project_storage_id)+ @project_storage = ::Storages::ProjectStorage.find_by(id: project_storage_id)super(@project_storage, **options)end+ def render?+ @project_storage.present?+ end+privatedef titlediff --git a/modules/storages/spec/components/storages/admin/oauth_access_grant_nudge_modal_component_spec.rb b/modules/storages/spec/components/storages/admin/oauth_access_grant_nudge_modal_component_spec.rbindex bec1ca5c9f4..a75633e8b79 100644--- a/modules/storages/spec/components/storages/admin/oauth_access_grant_nudge_modal_component_spec.rb+++ b/modules/storages/spec/components/storages/admin/oauth_access_grant_nudge_modal_component_spec.rb@@ -65,4 +65,12 @@ RSpec.describe Storages::Admin::OAuthAccessGrantNudgeModalComponent, type: :compexpect(page).to have_button('Close')endend++ context 'with no project storage' do+ let(:oauth_access_grant_nudge_modal_component) { described_class.new(project_storage_id: nil) }++ it 'does not render' do+ expect(page.text).to be_empty+ end+ endend