diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/serializers/diffs_metadata_entity.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/serializers/diffs_metadata_entity.rb')
-rw-r--r-- | app/serializers/diffs_metadata_entity.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/serializers/diffs_metadata_entity.rb b/app/serializers/diffs_metadata_entity.rb index b7024721ea9..8973f23734a 100644 --- a/app/serializers/diffs_metadata_entity.rb +++ b/app/serializers/diffs_metadata_entity.rb @@ -3,4 +3,23 @@ class DiffsMetadataEntity < DiffsEntity unexpose :diff_files expose :raw_diff_files, as: :diff_files, using: DiffFileMetadataEntity + + expose :conflict_resolution_path do |_, options| + presenter(options[:merge_request]).conflict_resolution_path + end + + expose :has_conflicts do |_, options| + options[:merge_request].cannot_be_merged? + end + + expose :can_merge do |_, options| + options[:merge_request].can_be_merged_by?(request.current_user) + end + + private + + def presenter(merge_request) + @presenters ||= {} + @presenters[merge_request] ||= MergeRequestPresenter.new(merge_request, current_user: request.current_user) # rubocop: disable CodeReuse/Presenter + end end |