Skip to content

Commit

Permalink
Merge pull request #15139 from opf/feature/53058-nudge-user-to-login-…
Browse files Browse the repository at this point in the history
…to-storage-upon-project-storage-edit

[#53058] Nudge user to login to storage upon project storage edit
  • Loading branch information
mereghost committed Mar 27, 2024
2 parents 435694d + 0323e6c commit 5d3241d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Expand Up @@ -143,8 +143,9 @@ def update
.call(permitted_storage_settings_params)

if service_result.success?
@project_storage = service_result.result
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to project_settings_project_storages_path
redirect_to_project_storages_path_with_oauth_access_grant_confirmation
else
@project_storage = @object
render "/storages/project_settings/edit"
Expand Down
Expand Up @@ -86,4 +86,22 @@
"redirect_uri=#{redirect_uri}&response_type=code&state=#{nonce}")
end
end

it "edits a storage, nudges the project admin to grant OAuth access" do
project_storage = create(:project_storage, project:, storage:)

visit edit_project_settings_project_storage_path(project_id: project, id: project_storage)

expect(page).to have_text("Edit the file storage to this project")

click_on "Save"

within_test_selector("oauth-access-grant-nudge-modal") do
expect(page).to be_axe_clean
expect(page).to have_text("One more step...")
click_on("Login")
wait_for(page).to have_current_path("/index.php/apps/oauth2/authorize?client_id=#{storage.oauth_client.client_id}&" \
"redirect_uri=#{redirect_uri}&response_type=code&state=#{nonce}")
end
end
end

0 comments on commit 5d3241d

Please sign in to comment.