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
44954c50
Commit
44954c50
authored
Apr 25, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix import of notes on Pull Request diff
parent
39ab842b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
lib/github/import.rb
lib/github/import.rb
+11
-4
lib/github/representation/comment.rb
lib/github/representation/comment.rb
+0
-4
lib/github/response.rb
lib/github/response.rb
+1
-1
No files found.
lib/github/import.rb
View file @
44954c50
...
...
@@ -30,6 +30,14 @@ module Github
self
.
reset_callbacks
:validate
end
class
LegacyDiffNote
<
::
LegacyDiffNote
self
.
table_name
=
'notes'
self
.
reset_callbacks
:commit
self
.
reset_callbacks
:update
self
.
reset_callbacks
:validate
end
attr_reader
:project
,
:repository
,
:repo
,
:options
,
:errors
,
:cached
def
initialize
(
project
,
options
)
...
...
@@ -177,7 +185,7 @@ module Github
# Fetch review comments
review_comments_url
=
"/repos/
#{
repo
}
/pulls/
#{
pull_request
.
iid
}
/comments"
fetch_comments
(
merge_request
,
:review_comment
,
review_comments_url
)
fetch_comments
(
merge_request
,
:review_comment
,
review_comments_url
,
LegacyDiffNote
)
# Fetch comments
comments_url
=
"/repos/
#{
repo
}
/issues/
#{
pull_request
.
iid
}
/comments"
...
...
@@ -245,7 +253,7 @@ module Github
end
end
def
fetch_comments
(
noteable
,
type
,
url
)
def
fetch_comments
(
noteable
,
type
,
url
,
klass
=
Note
)
while
url
comments
=
Github
::
Client
.
new
(
options
).
get
(
url
)
...
...
@@ -255,14 +263,13 @@ module Github
representation
=
Github
::
Representation
::
Comment
.
new
(
raw
,
options
)
author_id
=
user_id
(
representation
.
author
,
project
.
creator_id
)
note
=
Note
.
new
note
=
klass
.
new
note
.
project_id
=
project
.
id
note
.
noteable
=
noteable
note
.
note
=
format_description
(
representation
.
note
,
representation
.
author
)
note
.
commit_id
=
representation
.
commit_id
note
.
line_code
=
representation
.
line_code
note
.
author_id
=
author_id
note
.
type
=
representation
.
type
note
.
created_at
=
representation
.
created_at
note
.
updated_at
=
representation
.
updated_at
note
.
save!
(
validate:
false
)
...
...
lib/github/representation/comment.rb
View file @
44954c50
...
...
@@ -20,10 +20,6 @@ module Github
generate_line_code
(
parsed_lines
.
to_a
.
last
)
end
def
type
'LegacyDiffNote'
if
on_diff?
end
private
def
generate_line_code
(
line
)
...
...
lib/github/response.rb
View file @
44954c50
...
...
@@ -9,7 +9,7 @@ module Github
end
def
body
@body
||=
Oj
.
load
(
raw
.
body
,
class_cache:
false
,
mode: :compat
)
Oj
.
load
(
raw
.
body
,
class_cache:
false
,
mode: :compat
)
end
def
rels
...
...
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