Commit 86a01c36 authored by Serena Fang's avatar Serena Fang Committed by Douglas Barbosa Alexandre

Fix bot token name in issues

Changelog: fixed
parent 35f1dd93
......@@ -40,9 +40,7 @@ class MemberEntity < Grape::Entity
expose :valid_level_roles, as: :valid_roles
expose :user, if: -> (member) { member.user.present? } do |member, options|
MemberUserEntity.represent(member.user, options)
end
expose :user, if: -> (member) { member.user.present? }, using: MemberUserEntity
expose :state
......
......@@ -10,6 +10,6 @@ module RequestAwareEntity
end
def request
options.fetch(:request)
options.fetch(:request, nil)
end
end
......@@ -3,11 +3,15 @@
module API
module Entities
class UserSafe < Grape::Entity
include RequestAwareEntity
expose :id, :username
expose :name do |user|
next user.name unless user.project_bot?
next user.name if options[:current_user]&.can?(:read_project, user.projects.first)
current_user = request.respond_to?(:current_user) ? request.current_user : options.fetch(:current_user, nil)
next user.name if current_user&.can?(:read_project, user.projects.first)
# If the requester does not have permission to read the project bot name,
# the API returns an arbitrary string. UI changes will be addressed in a follow up issue:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment