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
Léo-Paul Géneau
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 @@
module
BitbucketServer
module
Representation
class
Activity
<
Representation
::
Base
def
action
raw
[
'action'
]
end
def
comment?
action
==
'COMMENTED'
end
def
inline_comment?
comment?
&&
comment_anchor
!!
(
comment?
&&
comment_anchor
)
end
def
comment
...
...
@@ -26,57 +22,41 @@ module BitbucketServer
end
end
#
XXX
Move this into MergeEvent
#
TODO
Move this into MergeEvent
def
merge_event?
action
==
'MERGED'
end
def
committer_user
commit
.
fetch
(
'committer'
,
{})[
'displayName'
]
raw
.
dig
(
'commit'
,
'committer'
,
'displayName'
)
end
def
committer_email
commit
.
fetch
(
'committer'
,
{})[
'emailAddress'
]
raw
.
dig
(
'commit'
,
'committer'
,
'emailAddress'
)
end
def
merge_timestamp
timestamp
=
commit
.
fetch
(
'committer'
,
{})[
'commiterTimestamp'
]
timestamp
=
raw
.
dig
(
'commit'
,
'committerTimestamp'
)
Time
.
at
(
timestamp
/
1000.0
)
if
timestamp
.
is_a?
(
Integer
)
end
def
commit
raw
.
fetch
(
'commit'
,
{})
end
def
created_at
Time
.
at
(
created_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
end
def
updated_at
Time
.
at
(
updated_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
end
private
def
raw_comment
raw
.
fetch
(
'comment'
,
{})
def
action
raw
[
'action'
]
end
def
comment_anchor
raw
[
'commentAnchor'
]
end
def
author
raw_comment
.
fetch
(
'author'
,
{})
end
def
created_date
comment
[
'createdDate'
]
end
def
updated_date
comment
[
'updatedDate'
]
raw
.
dig
(
'createdDate'
)
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