Expose avatar URL for groups

This commit is contained in:
Alfredo Sumaran 2017-06-06 19:21:53 -05:00
parent bd95138414
commit 3427912ed4
2 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ module GroupsHelper
group = Group.find_by_full_path(group)
end
group.try(:avatar_url) || image_path('no_group_avatar.png')
group.try(:avatar_url) || ActionController::Base.helpers.image_path('no_group_avatar.png')
end
def group_title(group, name = nil, url = nil)

View File

@ -2,9 +2,9 @@ class GroupEntity < Grape::Entity
include ActionView::Helpers::NumberHelper
include RequestAwareEntity
include MembersHelper
include GroupsHelper
expose :id, :name, :path, :description, :visibility
expose :avatar_url
expose :web_url
expose :full_name, :full_path
expose :parent_id
@ -39,4 +39,8 @@ class GroupEntity < Grape::Entity
expose :number_users_with_delimiter do |group|
number_with_delimiter(group.users.count)
end
expose :avatar_url do |group|
group_icon(group)
end
end