2018-12-13 14:17:19 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class SuggestionEntity < API::Entities::Suggestion
|
|
|
|
include RequestAwareEntity
|
|
|
|
|
2019-04-04 09:08:34 -04:00
|
|
|
unexpose :from_line, :to_line, :from_content, :to_content
|
|
|
|
expose :diff_lines, using: DiffLineEntity
|
2018-12-13 14:17:19 -05:00
|
|
|
expose :current_user do
|
|
|
|
expose :can_apply do |suggestion|
|
|
|
|
Ability.allowed?(current_user, :apply_suggestion, suggestion)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def current_user
|
|
|
|
request.current_user
|
|
|
|
end
|
|
|
|
end
|