BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
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