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
Jérome Perrin
gitlab-ce
Commits
c9aee48c
Commit
c9aee48c
authored
Jul 25, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add resolved methods on Discussion
parent
46cc034e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
app/models/discussion.rb
app/models/discussion.rb
+19
-1
No files found.
app/models/discussion.rb
View file @
c9aee48c
class
Discussion
class
Discussion
NUMBER_OF_TRUNCATED_DIFF_LINES
=
16
NUMBER_OF_TRUNCATED_DIFF_LINES
=
16
attr_reader
:first_note
,
:notes
attr_reader
:first_note
,
:
last_note
,
:
notes
delegate
:created_at
,
delegate
:created_at
,
:project
,
:project
,
...
@@ -18,6 +18,11 @@ class Discussion
...
@@ -18,6 +18,11 @@ class Discussion
to: :first_note
to: :first_note
delegate
:resolved_at
,
:resolved_by
,
to: :last_note
delegate
:blob
,
:highlighted_diff_lines
,
to: :diff_file
,
allow_nil:
true
delegate
:blob
,
:highlighted_diff_lines
,
to: :diff_file
,
allow_nil:
true
def
self
.
for_notes
(
notes
)
def
self
.
for_notes
(
notes
)
...
@@ -30,6 +35,7 @@ class Discussion
...
@@ -30,6 +35,7 @@ class Discussion
def
initialize
(
notes
)
def
initialize
(
notes
)
@first_note
=
notes
.
first
@first_note
=
notes
.
first
@last_note
=
notes
.
last
@notes
=
notes
@notes
=
notes
end
end
...
@@ -45,6 +51,18 @@ class Discussion
...
@@ -45,6 +51,18 @@ class Discussion
notes
.
any?
(
&
:legacy_diff_note?
)
notes
.
any?
(
&
:legacy_diff_note?
)
end
end
def
resolvable?
diff_discussion?
&&
notes
.
any?
(
&
:resolvable?
)
end
def
resolved?
notes
.
none?
(
&
:to_be_resolved?
)
end
def
to_be_resolved?
notes
.
any?
(
&
:to_be_resolved?
)
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