]> git.openstreetmap.org Git - rails.git/commitdiff
Check user instead of scope when getting note author info
authorAnton Khorev <tony29@yandex.ru>
Sat, 15 Feb 2025 00:34:53 +0000 (03:34 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sat, 15 Feb 2025 00:45:53 +0000 (03:45 +0300)
Previously it was possible to create a note while authorized but having no write_notes scope. Currently it's not possible.

app/controllers/api/notes_controller.rb

index bc4d2eaf2ceaa47076e57e4182fdcca583d65809..a0095d954b5d6f48dd891560d11c7f755523c964 100644 (file)
@@ -387,7 +387,7 @@ module Api
     ##
     # Get author's information (for logged in users - user_id, for logged out users - IP address)
     def author_info
-      if scope_enabled?(:write_notes)
+      if current_user
         { :user_id => current_user.id }
       else
         { :user_ip => request.remote_ip }