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
ed6c8238
Commit
ed6c8238
authored
Jul 25, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add access checks for diff note and discussion resolution
parent
bbab5d01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
app/models/ability.rb
app/models/ability.rb
+7
-1
app/models/discussion.rb
app/models/discussion.rb
+8
-0
No files found.
app/models/ability.rb
View file @
ed6c8238
...
...
@@ -257,6 +257,7 @@ class Ability
:create_merge_request
,
:create_wiki
,
:push_code
,
:resolve_note
,
:create_container_image
,
:update_container_image
,
:create_environment
,
...
...
@@ -426,7 +427,8 @@ class Ability
rules
+=
[
:read_note
,
:update_note
,
:admin_note
:admin_note
,
:resolve_note
]
end
...
...
@@ -434,6 +436,10 @@ class Ability
rules
+=
project_abilities
(
user
,
note
.
project
)
end
if
note
.
for_merge_request?
&&
note
.
noteable
.
author
==
user
rules
<<
:resolve_note
end
rules
end
...
...
app/models/discussion.rb
View file @
ed6c8238
...
...
@@ -63,6 +63,14 @@ class Discussion
notes
.
any?
(
&
:to_be_resolved?
)
end
def
can_resolve?
(
current_user
)
return
false
unless
current_user
return
false
unless
resolvable?
current_user
==
self
.
noteable
.
author
||
can?
(
current_user
,
:push_code
,
self
.
project
)
end
def
resolve!
(
current_user
)
notes
.
each
do
|
note
|
note
.
resolve!
(
current_user
)
if
note
.
resolvable?
...
...
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