[openstreetmap/openstreetmap-website] Remove OAuth 1 ApiCapability user branch (PR #5152)

Tom Hughes notifications at github.com
Tue Sep 3 16:17:19 UTC 2024


@tomhughes requested changes on this pull request.



> @@ -5,11 +5,7 @@ class ApiCapability
 
   def initialize(token)
     if Settings.status != "database_offline"
-      user = if token.respond_to?(:resource_owner_id)
-               User.find(token.resource_owner_id)
-             elsif token.respond_to?(:user)
-               token.user
-             end
+      user = (User.find(token.resource_owner_id) if token.respond_to?(:resource_owner_id))

We don't actually need the condition at all - we should always have a token and it should always be an OAuth 2 token now.

There is a test that will need fixing but it's a bogus test that deliberately passes `nil` as the token which is not valid. The real code never does that.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5152#pullrequestreview-2277909768
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5152/review/2277909768 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240903/4e1af560/attachment.htm>


More information about the rails-dev mailing list