Simplify write_notes scope check in api notes controller

This commit is contained in:
Anton Khorev 2025-01-24 06:16:11 +03:00
parent 8cf77a2f36
commit 47d55a2b0f
2 changed files with 12 additions and 5 deletions

View file

@ -384,11 +384,7 @@ module Api
def add_comment(note, text, event, notify: true)
attributes = { :visible => true, :event => event, :body => text }
if doorkeeper_token
author = current_user if scope_enabled?(:write_notes)
else
author = current_user
end
author = current_user if scope_enabled?(:write_notes)
if author
attributes[:author_id] = author.id