Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Privacy
Imprint
Contact
Login methods
Sign in
Toggle navigation
Menu
Open sidebar
projects.thm.de
GitLab
Commits
46cc034e
Commit
46cc034e
authored
Jul 25, 2016
by
Douwe Maan
Browse files
Add resolved_at and resolved_by_id to DiffNote
parent
44ad0743
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/models/diff_note.rb
View file @
46cc034e
...
...
@@ -4,11 +4,14 @@ class DiffNote < Note
serialize
:original_position
,
Gitlab
::
Diff
::
Position
serialize
:position
,
Gitlab
::
Diff
::
Position
belongs_to
:resolved_by
,
class_name:
"User"
validates
:original_position
,
presence:
true
validates
:position
,
presence:
true
validates
:diff_line
,
presence:
true
validates
:line_code
,
presence:
true
,
line_code:
true
validates
:noteable_type
,
inclusion:
{
in:
[
'Commit'
,
'MergeRequest'
]
}
validates
:resolved_by
,
presence:
true
,
if: :resolved?
validate
:positions_complete
validate
:verify_supported
...
...
@@ -72,6 +75,16 @@ def active?(diff_refs = nil)
self
.
position
.
diff_refs
==
diff_refs
end
def
resolvable?
!
system
?
&&
!
for_commit?
end
def
resolved?
return
false
unless
resolvable?
self
.
resolved_at
.
present?
end
private
def
supported?
...
...
app/models/note.rb
View file @
46cc034e
...
...
@@ -128,6 +128,18 @@ def active?
true
end
def
resolvable?
false
end
def
resolved?
false
end
def
to_be_resolved?
resolvable?
&&
!
resolved?
end
def
discussion_id
@discussion_id
||=
if
for_merge_request?
...
...
db/migrate/20160724205507_add_resolved_to_notes.rb
0 → 100644
View file @
46cc034e
class
AddResolvedToNotes
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:notes
,
:resolved_at
,
:datetime
add_column
:notes
,
:resolved_by_id
,
:integer
end
end
db/schema.rb
View file @
46cc034e
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2016072
1081015
)
do
ActiveRecord
::
Schema
.
define
(
version:
2016072
4205507
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -705,6 +705,8 @@
t
.
string
"type"
t
.
text
"position"
t
.
text
"original_position"
t
.
datetime
"resolved_at"
t
.
integer
"resolved_by_id"
end
add_index
"notes"
,
[
"author_id"
],
name:
"index_notes_on_author_id"
,
using: :btree
...
...
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