summaryrefslogtreecommitdiff
path: root/app/models/group.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-07-28 15:49:44 +0200
committerDouwe Maan <douwe@gitlab.com>2015-07-28 15:49:44 +0200
commita784b996b3071cfe1807b1108316143dbc64492f (patch)
treee7f538d5837c8e2eac4c1b342ad3e154e594406a /app/models/group.rb
parent43d118803133558209973464b1c16fd4c7ba446c (diff)
downloadgitlab-ce-a784b996b3071cfe1807b1108316143dbc64492f.tar.gz
Add project star and fork count, group avatar URL and user/group web URL attributes to API
Diffstat (limited to 'app/models/group.rb')
-rw-r--r--app/models/group.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 051c672cb33..adcbbec465e 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -17,6 +17,7 @@ require 'carrierwave/orm/activerecord'
require 'file_size_validator'
class Group < Namespace
+ include Gitlab::ConfigHelper
include Referable
has_many :group_members, dependent: :destroy, as: :source, class_name: 'GroupMember'
@@ -56,6 +57,16 @@ class Group < Namespace
name
end
+ def avatar_url(size = nil)
+ if avatar.present?
+ [gitlab_config.url, avatar.url].join
+ end
+ end
+
+ def web_url
+ [gitlab_config.url, "groups", self.path].join('/')
+ end
+
def owners
@owners ||= group_members.owners.map(&:user)
end