Skip to content

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

Remove old commented code and switches to id

Marcello Rocha8d37391e65bc
diff --git a/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb b/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb
index 847f5e67e21..840061f5bd3 100644
--- a/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb
+++ b/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb
@@ -56,15 +56,12 @@ module Storages
def extract_origin_user_id(rack_access_token)
Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|
- response = http.get('/v1.0/me',
- { Authorization: "Bearer #{rack_access_token.access_token}", Accept: 'application/json' })
+ response = http.get(
+ '/v1.0/me',
+ { Authorization: "Bearer #{rack_access_token.access_token}", Accept: 'application/json' }
+ )
- # if response == Net::HTTPSuccess
- parsed = JSON.parse(response.body)
- parsed['userPrincipalName']
- # else
- # nil
- # end
+ JSON.parse(response.body)['id']
end
end
diff --git a/spec/services/oauth_clients/one_drive_connection_manager_spec.rb b/spec/services/oauth_clients/one_drive_connection_manager_spec.rb
index c6dfa2a3d3c..c44a0503fe4 100644
--- a/spec/services/oauth_clients/one_drive_connection_manager_spec.rb
+++ b/spec/services/oauth_clients/one_drive_connection_manager_spec.rb
@@ -84,7 +84,7 @@ RSpec.describe OAuthClients::ConnectionManager, :webmock, type: :model do
.where(access_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik5HVEZ2ZEstZnl0aEV1Q...")
.last
- expect(last_token.origin_user_id).to eq('[email protected]')
+ expect(last_token.origin_user_id).to eq('87d349ed-44d7-43e1-9a83-5f2406dee5bd')
end
end