Commit 803ca4b8 authored by Serena Fang's avatar Serena Fang Committed by Douglas Barbosa Alexandre

Apply reviewer suggestions

parent 1edd7c71
......@@ -134,8 +134,6 @@ module Types
end
def redacted_name
return object.name unless object.project_bot?
object.secure_name(context[:current_user])
end
end
......
......@@ -48,6 +48,8 @@ module HasUserType
end
def secure_name(viewing_user)
return self.name unless self.project_bot?
if self.groups.any?
return self.name if viewing_user&.can?(:read_group, self.groups.first)
end
......
......@@ -5,8 +5,6 @@ module API
class UserSafe < Grape::Entity
expose :id, :username
expose :name do |user|
next user.name unless user.project_bot?
user.secure_name(options[:current_user])
end
end
......
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