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
2c92cc52
Commit
2c92cc52
authored
Apr 12, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comment representation
parent
0b1d1931
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
lib/github/representation/comment.rb
lib/github/representation/comment.rb
+58
-0
No files found.
lib/github/representation/comment.rb
0 → 100644
View file @
2c92cc52
module
Github
module
Representation
class
Comment
<
Representation
::
Base
def
note
raw
[
'body'
]
||
''
end
def
author
@author
||=
Github
::
Representation
::
User
.
new
(
raw
[
'user'
])
end
def
commit_id
raw
[
'commit_id'
]
end
def
line_code
return
unless
on_diff?
parsed_lines
=
Gitlab
::
Diff
::
Parser
.
new
.
parse
(
diff_hunk
.
lines
)
generate_line_code
(
parsed_lines
.
to_a
.
last
)
end
def
type
'LegacyDiffNote'
if
on_diff?
end
def
url
raw
[
'url'
]
end
def
created_at
raw
[
'created_at'
]
end
def
updated_at
raw
[
'updated_at'
]
end
private
def
generate_line_code
(
line
)
Gitlab
::
Diff
::
LineCode
.
generate
(
file_path
,
line
.
new_pos
,
line
.
old_pos
)
end
def
on_diff?
diff_hunk
.
present?
end
def
diff_hunk
raw_data
.
diff_hunk
end
def
file_path
raw_data
.
path
end
end
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