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
Boxiang Sun
gitlab-ce
Commits
a9200d93
Commit
a9200d93
authored
Apr 13, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that issues and merge requests are found
parent
fa300909
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
7 deletions
+20
-7
doc/api/merge_requests.md
doc/api/merge_requests.md
+1
-0
lib/api/issues.rb
lib/api/issues.rb
+4
-4
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+3
-3
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+12
-0
No files found.
doc/api/merge_requests.md
View file @
a9200d93
...
@@ -680,6 +680,7 @@ Example response:
...
@@ -680,6 +680,7 @@ Example response:
"subscribed"
:
true
"subscribed"
:
true
}
}
```
```
## Unsubscribe from a merge request
## Unsubscribe from a merge request
Unsubscribes the authenticated user from a merge request to not receive
Unsubscribes the authenticated user from a merge request to not receive
...
...
lib/api/issues.rb
View file @
a9200d93
...
@@ -239,8 +239,8 @@ module API
...
@@ -239,8 +239,8 @@ module API
# issue_id (required) - The ID of a project issue
# issue_id (required) - The ID of a project issue
# Example Request:
# Example Request:
# POST /projects/:id/issues/:issue_id/subscription
# POST /projects/:id/issues/:issue_id/subscription
post
":id/issues/:issue_id/subscription"
do
post
':id/issues/:issue_id/subscription'
do
issue
=
user_project
.
issues
.
find
_by
(
id:
params
[
:issue_id
])
issue
=
user_project
.
issues
.
find
(
params
[
:issue_id
])
if
issue
.
subscribed?
(
current_user
)
if
issue
.
subscribed?
(
current_user
)
not_modified!
not_modified!
...
@@ -257,8 +257,8 @@ module API
...
@@ -257,8 +257,8 @@ module API
# issue_id (required) - The ID of a project issue
# issue_id (required) - The ID of a project issue
# Example Request:
# Example Request:
# DELETE /projects/:id/issues/:issue_id/subscription
# DELETE /projects/:id/issues/:issue_id/subscription
delete
":id/issues/:issue_id/subscription"
do
delete
':id/issues/:issue_id/subscription'
do
issue
=
user_project
.
issues
.
find
_by
(
id:
params
[
:issue_id
])
issue
=
user_project
.
issues
.
find
(
params
[
:issue_id
])
if
issue
.
subscribed?
(
current_user
)
if
issue
.
subscribed?
(
current_user
)
issue
.
unsubscribe
(
current_user
)
issue
.
unsubscribe
(
current_user
)
...
...
spec/requests/api/issues_spec.rb
View file @
a9200d93
...
@@ -594,20 +594,20 @@ describe API::API, api: true do
...
@@ -594,20 +594,20 @@ describe API::API, api: true do
describe
'DELETE :id/issues/:issue_id/subscription'
do
describe
'DELETE :id/issues/:issue_id/subscription'
do
it
'unsubscribes from an issue'
do
it
'unsubscribes from an issue'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/subscription"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/subscription"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'subscribed'
]).
to
eq
(
false
)
expect
(
json_response
[
'subscribed'
]).
to
eq
(
false
)
end
end
it
'returns 304 if not subscribed'
do
it
'returns 304 if not subscribed'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/subscription"
,
user2
)
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/subscription"
,
user2
)
expect
(
response
.
status
).
to
eq
(
304
)
expect
(
response
.
status
).
to
eq
(
304
)
end
end
it
'returns 404 if the issue is not found'
do
it
'returns 404 if the issue is not found'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/123/subscription"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/issues/123/subscription"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
a9200d93
...
@@ -529,6 +529,12 @@ describe API::API, api: true do
...
@@ -529,6 +529,12 @@ describe API::API, api: true do
expect
(
response
.
status
).
to
eq
(
304
)
expect
(
response
.
status
).
to
eq
(
304
)
end
end
it
'returns 404 if the merge request is not found'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/123/subscription"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
describe
'DELETE :id/merge_requests/:merge_request_id/subscription'
do
describe
'DELETE :id/merge_requests/:merge_request_id/subscription'
do
...
@@ -544,6 +550,12 @@ describe API::API, api: true do
...
@@ -544,6 +550,12 @@ describe API::API, api: true do
expect
(
response
.
status
).
to
eq
(
304
)
expect
(
response
.
status
).
to
eq
(
304
)
end
end
it
'returns 404 if the merge request is not found'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/123/subscription"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
def
mr_with_later_created_and_updated_at_time
def
mr_with_later_created_and_updated_at_time
...
...
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