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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
07f516d1
Commit
07f516d1
authored
Apr 05, 2018
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust 404's for LegacyDiffNote discussion rendering
parent
166b4575
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
+54
-2
app/controllers/projects/discussions_controller.rb
app/controllers/projects/discussions_controller.rb
+2
-2
changelogs/unreleased/osw-44295-adjust-authorization-for-discussions-show.yml
...d/osw-44295-adjust-authorization-for-discussions-show.yml
+5
-0
spec/controllers/projects/discussions_controller_spec.rb
spec/controllers/projects/discussions_controller_spec.rb
+47
-0
No files found.
app/controllers/projects/discussions_controller.rb
View file @
07f516d1
...
...
@@ -4,8 +4,8 @@ class Projects::DiscussionsController < Projects::ApplicationController
before_action
:check_merge_requests_available!
before_action
:merge_request
before_action
:discussion
before_action
:authorize_resolve_discussion!
before_action
:discussion
,
only:
[
:resolve
,
:unresolve
]
before_action
:authorize_resolve_discussion!
,
only:
[
:resolve
,
:unresolve
]
def
resolve
Discussions
::
ResolveService
.
new
(
project
,
current_user
,
merge_request:
merge_request
).
execute
(
discussion
)
...
...
changelogs/unreleased/osw-44295-adjust-authorization-for-discussions-show.yml
0 → 100644
View file @
07f516d1
---
title
:
Adjust 404's for LegacyDiffNote discussion rendering
merge_request
:
18201
author
:
type
:
fixed
spec/controllers/projects/discussions_controller_spec.rb
View file @
07f516d1
...
...
@@ -16,6 +16,53 @@ describe Projects::DiscussionsController do
}
end
describe
'GET show'
do
before
do
sign_in
user
end
context
'when user is not authorized to read the MR'
do
it
'returns 404'
do
get
:show
,
request_params
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
context
'when user is authorized to read the MR'
do
before
do
project
.
add_reporter
(
user
)
end
it
'returns status 200'
do
get
:show
,
request_params
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
it
'returns status 404 if MR does not exists'
do
merge_request
.
destroy!
get
:show
,
request_params
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
context
'when user is authorized but note is LegacyDiffNote'
do
before
do
project
.
add_developer
(
user
)
note
.
update!
(
type:
'LegacyDiffNote'
)
end
it
'returns status 200'
do
get
:show
,
request_params
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
end
describe
'POST resolve'
do
before
do
sign_in
user
...
...
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