debian-mirror-gitlab/lib/api/entities/merge_request_approvals.rb

24 lines
722 B
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
module API
module Entities
class MergeRequestApprovals < Grape::Entity
2023-01-13 00:05:48 +05:30
expose :user_has_approved, documentation: { type: 'boolean' } do |merge_request, options|
2020-07-28 23:09:34 +05:30
merge_request.approved_by?(options[:current_user])
end
2023-01-13 00:05:48 +05:30
expose :user_can_approve, documentation: { type: 'boolean' } do |merge_request, options|
2022-11-25 23:54:43 +05:30
merge_request.eligible_for_approval_by?(options[:current_user])
2020-07-28 23:09:34 +05:30
end
2023-01-13 00:05:48 +05:30
expose :approved, documentation: { type: 'boolean' } do |merge_request|
2020-07-28 23:09:34 +05:30
merge_request.approvals.present?
end
expose :approved_by, using: ::API::Entities::Approvals do |merge_request|
merge_request.approvals
end
end
end
end