diff options
author | Igor <idrozdov@gitlab.com> | 2019-07-17 16:06:19 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-17 16:06:19 +0300 |
commit | 0f46886880e46344856ede52dd3b500e4d6737ac (patch) | |
tree | 263867f1fba61ad987ca63d1253f15926d72d143 /app/serializers/diff_file_base_entity.rb | |
parent | b62c049f2db1e399dcd3c02b2507d444aeffe50d (diff) |
Added submodule links to Submodule type in GraphQL API
This is part of migration of Folder View to Vue
Diffstat (limited to 'app/serializers/diff_file_base_entity.rb')
-rw-r--r-- | app/serializers/diff_file_base_entity.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/serializers/diff_file_base_entity.rb b/app/serializers/diff_file_base_entity.rb index d8630165e49..ee68b4b98e0 100644 --- a/app/serializers/diff_file_base_entity.rb +++ b/app/serializers/diff_file_base_entity.rb @@ -3,7 +3,6 @@ class DiffFileBaseEntity < Grape::Entity include RequestAwareEntity include BlobHelper - include SubmoduleHelper include DiffHelper include TreeHelper include ChecksCollaboration @@ -12,12 +11,12 @@ class DiffFileBaseEntity < Grape::Entity expose :content_sha expose :submodule?, as: :submodule - expose :submodule_link do |diff_file| - memoized_submodule_links(diff_file).first + expose :submodule_link do |diff_file, options| + memoized_submodule_links(diff_file, options).first end expose :submodule_tree_url do |diff_file| - memoized_submodule_links(diff_file).last + memoized_submodule_links(diff_file, options).last end expose :edit_path, if: -> (_, options) { options[:merge_request] } do |diff_file| @@ -92,10 +91,10 @@ class DiffFileBaseEntity < Grape::Entity private - def memoized_submodule_links(diff_file) + def memoized_submodule_links(diff_file, options) strong_memoize(:submodule_links) do if diff_file.submodule? - submodule_links(diff_file.blob, diff_file.content_sha, diff_file.repository) + options[:submodule_links].for(diff_file.blob, diff_file.content_sha) else [] end |