Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
a784b996
Commit
a784b996
authored
Jul 28, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project star and fork count, group avatar URL and user/group web URL attributes to API
parent
43d11880
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletion
+19
-1
CHANGELOG
CHANGELOG
+1
-0
app/models/group.rb
app/models/group.rb
+11
-0
app/models/user.rb
app/models/user.rb
+4
-0
lib/api/entities.rb
lib/api/entities.rb
+3
-1
No files found.
CHANGELOG
View file @
a784b996
...
...
@@ -16,6 +16,7 @@ v 7.14.0 (unreleased)
- Expire Rails cache entries after two weeks to prevent endless Redis growth
- Add support for destroying project milestones (Stan Hu)
- Add fetch command to the MR page
- Add project star and fork count, group avatar URL and user/group web URL attributes to API
v 7.13.1
- Fix: Label modifications are not reflected in existing notes and in the issue list
...
...
app/models/group.rb
View file @
a784b996
...
...
@@ -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
...
...
app/models/user.rb
View file @
a784b996
...
...
@@ -637,6 +637,10 @@ class User < ActiveRecord::Base
end
end
def
web_url
[
gitlab_config
.
url
,
"u"
,
self
.
username
].
join
(
'/'
)
end
def
all_emails
[
self
.
email
,
*
self
.
emails
.
map
(
&
:email
)]
end
...
...
lib/api/entities.rb
View file @
a784b996
...
...
@@ -5,7 +5,7 @@ module API
end
class
UserBasic
<
UserSafe
expose
:id
,
:state
,
:avatar_url
expose
:id
,
:state
,
:avatar_url
,
:web_url
end
class
User
<
UserBasic
...
...
@@ -59,6 +59,7 @@ module API
expose
:namespace
expose
:forked_from_project
,
using:
Entities
::
ForkedFromProject
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:avatar_url
expose
:star_count
,
:forks_count
end
class
ProjectMember
<
UserBasic
...
...
@@ -69,6 +70,7 @@ module API
class
Group
<
Grape
::
Entity
expose
:id
,
:name
,
:path
,
:description
expose
:avatar_url
,
:web_url
end
class
GroupDetail
<
Group
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment