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
00e3d60c
Commit
00e3d60c
authored
Apr 19, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract Github::Representation::Issuable
parent
f35573f1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
66 deletions
+39
-66
lib/github/representation/issuable.rb
lib/github/representation/issuable.rb
+37
-0
lib/github/representation/issue.rb
lib/github/representation/issue.rb
+1
-33
lib/github/representation/pull_request.rb
lib/github/representation/pull_request.rb
+1
-33
No files found.
lib/github/representation/issuable.rb
0 → 100644
View file @
00e3d60c
module
Github
module
Representation
class
Issuable
<
Representation
::
Base
def
iid
raw
[
'number'
]
end
def
title
raw
[
'title'
]
end
def
description
raw
[
'body'
]
||
''
end
def
milestone
return
unless
raw
[
'milestone'
].
present?
@milestone
||=
Github
::
Representation
::
Milestone
.
new
(
raw
[
'milestone'
])
end
def
author
@author
||=
Github
::
Representation
::
User
.
new
(
raw
[
'user'
])
end
def
assignee
return
unless
assigned?
@assignee
||=
Github
::
Representation
::
User
.
new
(
raw
[
'assignee'
])
end
def
assigned?
raw
[
'assignee'
].
present?
end
end
end
end
lib/github/representation/issue.rb
View file @
00e3d60c
module
Github
module
Representation
class
Issue
<
Representation
::
Base
def
iid
raw
[
'number'
]
end
def
title
raw
[
'title'
]
end
def
description
raw
[
'body'
]
||
''
end
class
Issue
<
Representation
::
Issuable
def
labels
raw
[
'labels'
]
end
def
milestone
return
unless
raw
[
'milestone'
].
present?
@milestone
||=
Github
::
Representation
::
Milestone
.
new
(
raw
[
'milestone'
])
end
def
author
@author
||=
Github
::
Representation
::
User
.
new
(
raw
[
'user'
])
end
def
assignee
return
unless
assigned?
@assignee
||=
Github
::
Representation
::
User
.
new
(
raw
[
'assignee'
])
end
def
state
raw
[
'state'
]
==
'closed'
?
'closed'
:
'opened'
end
def
assigned?
raw
[
'assignee'
].
present?
end
def
has_comments?
raw
[
'comments'
]
>
0
end
...
...
lib/github/representation/pull_request.rb
View file @
00e3d60c
module
Github
module
Representation
class
PullRequest
<
Representation
::
Bas
e
class
PullRequest
<
Representation
::
Issuabl
e
attr_reader
:project
delegate
:user
,
:repo
,
:ref
,
:sha
,
to: :source_branch
,
prefix:
true
...
...
@@ -11,18 +11,6 @@ module Github
@raw
=
raw
end
def
iid
raw
[
'number'
]
end
def
title
raw
[
'title'
]
end
def
description
raw
[
'body'
]
||
''
end
def
source_project
project
end
...
...
@@ -48,22 +36,6 @@ module Github
@target_branch_name
||=
target_branch_exists?
?
target_branch_ref
:
target_branch_name_prefixed
end
def
milestone
return
unless
raw
[
'milestone'
].
present?
@milestone
||=
Github
::
Representation
::
Milestone
.
new
(
raw
[
'milestone'
])
end
def
author
@author
||=
Github
::
Representation
::
User
.
new
(
raw
[
'user'
])
end
def
assignee
return
unless
assigned?
@assignee
||=
Github
::
Representation
::
User
.
new
(
raw
[
'assignee'
])
end
def
state
return
'merged'
if
raw
[
'state'
]
==
'closed'
&&
raw
[
'merged_at'
].
present?
return
'closed'
if
raw
[
'state'
]
==
'closed'
...
...
@@ -71,10 +43,6 @@ module Github
'opened'
end
def
assigned?
raw
[
'assignee'
].
present?
end
def
opened?
state
==
'opened'
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