2020-07-10 17:09:29 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
class MergeRequestApprovals < Grape::Entity
|
2020-07-15 14:09:09 -04:00
|
|
|
expose :user_has_approved do |merge_request, options|
|
2020-07-16 11:09:38 -04:00
|
|
|
merge_request.approved_by?(options[:current_user])
|
2020-07-15 14:09:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
expose :user_can_approve do |merge_request, options|
|
2020-07-20 14:09:27 -04:00
|
|
|
merge_request.can_be_approved_by?(options[:current_user])
|
2020-07-15 14:09:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
expose :approved do |merge_request|
|
|
|
|
merge_request.approvals.present?
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :approved_by, using: ::API::Entities::Approvals do |merge_request|
|
|
|
|
merge_request.approvals
|
|
|
|
end
|
2020-07-10 17:09:29 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|