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
bf2d029a
Commit
bf2d029a
authored
Jul 25, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for pull request activity
parent
e47cf67e
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1129 additions
and
28 deletions
+1129
-28
lib/bitbucket_server/representation/activity.rb
lib/bitbucket_server/representation/activity.rb
+8
-28
spec/fixtures/importers/bitbucket_server/activities.json
spec/fixtures/importers/bitbucket_server/activities.json
+1121
-0
No files found.
lib/bitbucket_server/representation/activity.rb
View file @
bf2d029a
...
@@ -3,16 +3,12 @@
...
@@ -3,16 +3,12 @@
module
BitbucketServer
module
BitbucketServer
module
Representation
module
Representation
class
Activity
<
Representation
::
Base
class
Activity
<
Representation
::
Base
def
action
raw
[
'action'
]
end
def
comment?
def
comment?
action
==
'COMMENTED'
action
==
'COMMENTED'
end
end
def
inline_comment?
def
inline_comment?
comment?
&&
comment_anchor
!!
(
comment?
&&
comment_anchor
)
end
end
def
comment
def
comment
...
@@ -26,57 +22,41 @@ module BitbucketServer
...
@@ -26,57 +22,41 @@ module BitbucketServer
end
end
end
end
#
XXX
Move this into MergeEvent
#
TODO
Move this into MergeEvent
def
merge_event?
def
merge_event?
action
==
'MERGED'
action
==
'MERGED'
end
end
def
committer_user
def
committer_user
commit
.
fetch
(
'committer'
,
{})[
'displayName'
]
raw
.
dig
(
'commit'
,
'committer'
,
'displayName'
)
end
end
def
committer_email
def
committer_email
commit
.
fetch
(
'committer'
,
{})[
'emailAddress'
]
raw
.
dig
(
'commit'
,
'committer'
,
'emailAddress'
)
end
end
def
merge_timestamp
def
merge_timestamp
timestamp
=
commit
.
fetch
(
'committer'
,
{})[
'commiterTimestamp'
]
timestamp
=
raw
.
dig
(
'commit'
,
'committerTimestamp'
)
Time
.
at
(
timestamp
/
1000.0
)
if
timestamp
.
is_a?
(
Integer
)
Time
.
at
(
timestamp
/
1000.0
)
if
timestamp
.
is_a?
(
Integer
)
end
end
def
commit
raw
.
fetch
(
'commit'
,
{})
end
def
created_at
def
created_at
Time
.
at
(
created_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
Time
.
at
(
created_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
end
end
def
updated_at
Time
.
at
(
updated_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
end
private
private
def
raw_comment
def
action
raw
.
fetch
(
'comment'
,
{})
raw
[
'action'
]
end
end
def
comment_anchor
def
comment_anchor
raw
[
'commentAnchor'
]
raw
[
'commentAnchor'
]
end
end
def
author
raw_comment
.
fetch
(
'author'
,
{})
end
def
created_date
def
created_date
comment
[
'createdDate'
]
raw
.
dig
(
'createdDate'
)
end
def
updated_date
comment
[
'updatedDate'
]
end
end
end
end
end
end
...
...
spec/fixtures/importers/bitbucket_server/activities.json
0 → 100644
View file @
bf2d029a
This diff is collapsed.
Click to expand it.
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