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
Boxiang Sun
gitlab-ce
Commits
46cc034e
Commit
46cc034e
authored
Jul 25, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add resolved_at and resolved_by_id to DiffNote
parent
44ad0743
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
1 deletion
+38
-1
app/models/diff_note.rb
app/models/diff_note.rb
+13
-0
app/models/note.rb
app/models/note.rb
+12
-0
db/migrate/20160724205507_add_resolved_to_notes.rb
db/migrate/20160724205507_add_resolved_to_notes.rb
+10
-0
db/schema.rb
db/schema.rb
+3
-1
No files found.
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 @@ class DiffNote < Note
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 @@ class Note < ActiveRecord::Base
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 @@ ActiveRecord::Schema.define(version: 20160721081015) do
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