diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-02 03:08:37 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-02 03:08:37 +0000 |
commit | 78214bf7421d73e288466100df584d99e91154af (patch) | |
tree | 370acdddcf33f6df889841f1a9b762190466cf9d /lib/api/entities.rb | |
parent | d0356412dfc91d02585f0a177c65677dbe2944a3 (diff) | |
download | gitlab-ce-78214bf7421d73e288466100df584d99e91154af.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 88ca0906283..bd7b2fd9433 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -128,60 +128,6 @@ module API end end - class IssuableEntity < Grape::Entity - expose :id, :iid - expose(:project_id) { |entity| entity&.project.try(:id) } - expose :title, :description - expose :state, :created_at, :updated_at - - # Avoids an N+1 query when metadata is included - def issuable_metadata(subject, options, method, args = nil) - cached_subject = options.dig(:issuable_metadata, subject.id) - (cached_subject || subject).public_send(method, *args) # rubocop: disable GitlabSecurity/PublicSend - end - end - - class IssuableReferences < Grape::Entity - expose :short do |issuable| - issuable.to_reference - end - - expose :relative do |issuable, options| - issuable.to_reference(options[:group] || options[:project]) - end - - expose :full do |issuable| - issuable.to_reference(full: true) - end - end - - class Diff < Grape::Entity - expose :old_path, :new_path, :a_mode, :b_mode - expose :new_file?, as: :new_file - expose :renamed_file?, as: :renamed_file - expose :deleted_file?, as: :deleted_file - expose :json_safe_diff, as: :diff - end - - class ProtectedRefAccess < Grape::Entity - expose :access_level - expose :access_level_description do |protected_ref_access| - protected_ref_access.humanize - end - end - - class ProtectedBranch < Grape::Entity - expose :id - expose :name - expose :push_access_levels, using: Entities::ProtectedRefAccess - expose :merge_access_levels, using: Entities::ProtectedRefAccess - end - - class ProtectedTag < Grape::Entity - expose :name - expose :create_access_levels, using: Entities::ProtectedRefAccess - end - class Milestone < Grape::Entity expose :id, :iid expose :project_id, if: -> (entity, options) { entity&.project_id } |