Commit f516b8d0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Expose last_commit information for tree and blob when serialized

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 397a0a1d
...@@ -3,6 +3,10 @@ class BlobEntity < Grape::Entity ...@@ -3,6 +3,10 @@ class BlobEntity < Grape::Entity
expose :id, :path, :name, :mode expose :id, :path, :name, :mode
expose :last_commit do |blob|
request.project.repository.last_commit_for_path(blob.commit_id, blob.path)
end
expose :icon do |blob| expose :icon do |blob|
IconsHelper.file_type_icon_class('file', blob.mode, blob.name) IconsHelper.file_type_icon_class('file', blob.mode, blob.name)
end end
......
...@@ -3,6 +3,10 @@ class TreeEntity < Grape::Entity ...@@ -3,6 +3,10 @@ class TreeEntity < Grape::Entity
expose :id, :path, :name, :mode expose :id, :path, :name, :mode
expose :last_commit do |tree|
request.project.repository.last_commit_for_path(tree.commit_id, tree.path)
end
expose :icon do |tree| expose :icon do |tree|
IconsHelper.file_type_icon_class('folder', tree.mode, tree.name) IconsHelper.file_type_icon_class('folder', tree.mode, tree.name)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment