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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
dc2ca594
Commit
dc2ca594
authored
Jun 02, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose notification setting events in API
parent
e60999ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
lib/api/entities.rb
lib/api/entities.rb
+2
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+24
-5
No files found.
lib/api/entities.rb
View file @
dc2ca594
...
...
@@ -275,7 +275,8 @@ module API
expose
:access_level
expose
:notification_level
do
|
member
,
options
|
if
member
.
notification_setting
NotificationSetting
.
levels
[
member
.
notification_setting
.
level
]
setting
=
member
.
notification_setting
{
level:
NotificationSetting
.
levels
[
setting
.
level
],
events:
setting
.
events
}
end
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
dc2ca594
...
...
@@ -428,8 +428,9 @@ describe API::API, api: true do
describe
'permissions'
do
context
'all projects'
do
it
'Contains permission information'
do
project
.
team
<<
[
user
,
:master
]
before
{
project
.
team
<<
[
user
,
:master
]
}
it
'contains permission information'
do
get
api
(
"/projects"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
...
...
@@ -437,10 +438,18 @@ describe API::API, api: true do
to
eq
(
Gitlab
::
Access
::
MASTER
)
expect
(
json_response
.
first
[
'permissions'
][
'group_access'
]).
to
be_nil
end
it
'contains notification level information'
do
get
api
(
"/projects"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
.
first
[
'permissions'
][
'project_access'
][
'notification_level'
][
'level'
]).
to
eq
(
NotificationSetting
.
levels
[
:global
])
expect
(
json_response
.
first
[
'permissions'
][
'project_access'
][
'notification_level'
].
keys
).
to
include
(
'events'
)
end
end
context
'personal project'
do
it
'
S
ets project access and returns 200'
do
it
'
s
ets project access and returns 200'
do
project
.
team
<<
[
user
,
:master
]
get
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
...
...
@@ -452,9 +461,11 @@ describe API::API, api: true do
end
context
'group project'
do
let
(
:project2
)
{
create
(
:project
,
group:
create
(
:group
))
}
before
{
project2
.
group
.
add_owner
(
user
)
}
it
'should set the owner and return 200'
do
project2
=
create
(
:project
,
group:
create
(
:group
))
project2
.
group
.
add_owner
(
user
)
get
api
(
"/projects/
#{
project2
.
id
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
...
...
@@ -462,6 +473,14 @@ describe API::API, api: true do
expect
(
json_response
[
'permissions'
][
'group_access'
][
'access_level'
]).
to
eq
(
Gitlab
::
Access
::
OWNER
)
end
it
'shows notification level information'
do
get
api
(
"/projects/
#{
project2
.
id
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'permissions'
][
'group_access'
][
'notification_level'
][
'level'
]).
to
eq
(
NotificationSetting
.
levels
[
:global
])
expect
(
json_response
[
'permissions'
][
'group_access'
][
'notification_level'
].
keys
).
to
include
(
'events'
)
end
end
end
end
...
...
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