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
bbab5d01
Commit
bbab5d01
authored
Jul 25, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add methods to resolve diff notes and discussions
parent
c9aee48c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
app/models/diff_note.rb
app/models/diff_note.rb
+18
-0
app/models/discussion.rb
app/models/discussion.rb
+12
-0
No files found.
app/models/diff_note.rb
View file @
bbab5d01
...
@@ -85,6 +85,24 @@ class DiffNote < Note
...
@@ -85,6 +85,24 @@ class DiffNote < Note
self
.
resolved_at
.
present?
self
.
resolved_at
.
present?
end
end
def
resolve!
(
current_user
)
return
unless
resolvable?
return
if
resolved?
self
.
resolved_at
=
Time
.
now
self
.
resolved_by
=
current_user
save!
end
def
unresolve!
return
unless
resolvable?
return
unless
resolved?
self
.
resolved_at
=
nil
self
.
resolved_by
=
nil
save!
end
private
private
def
supported?
def
supported?
...
...
app/models/discussion.rb
View file @
bbab5d01
...
@@ -63,6 +63,18 @@ class Discussion
...
@@ -63,6 +63,18 @@ class Discussion
notes
.
any?
(
&
:to_be_resolved?
)
notes
.
any?
(
&
:to_be_resolved?
)
end
end
def
resolve!
(
current_user
)
notes
.
each
do
|
note
|
note
.
resolve!
(
current_user
)
if
note
.
resolvable?
end
end
def
unresolve!
notes
.
each
do
|
note
|
note
.
unresolve!
if
note
.
resolvable?
end
end
def
for_target?
(
target
)
def
for_target?
(
target
)
self
.
noteable
==
target
&&
!
diff_discussion?
self
.
noteable
==
target
&&
!
diff_discussion?
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