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
dd937377
Commit
dd937377
authored
Jul 28, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a class method to consolidate timestamp conversion
parent
ae6b48d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
lib/bitbucket_server/representation/activity.rb
lib/bitbucket_server/representation/activity.rb
+2
-2
lib/bitbucket_server/representation/base.rb
lib/bitbucket_server/representation/base.rb
+4
-0
lib/bitbucket_server/representation/comment.rb
lib/bitbucket_server/representation/comment.rb
+2
-2
lib/bitbucket_server/representation/pull_request.rb
lib/bitbucket_server/representation/pull_request.rb
+2
-2
No files found.
lib/bitbucket_server/representation/activity.rb
View file @
dd937377
...
...
@@ -38,11 +38,11 @@ module BitbucketServer
def
merge_timestamp
timestamp
=
raw
.
dig
(
'commit'
,
'committerTimestamp'
)
Time
.
at
(
timestamp
/
1000.0
)
if
timestamp
.
is_a?
(
Integer
)
self
.
class
.
convert_timestamp
(
timestamp
)
end
def
created_at
Time
.
at
(
created_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
self
.
class
.
convert_timestamp
(
created_date
)
end
private
...
...
lib/bitbucket_server/representation/base.rb
View file @
dd937377
...
...
@@ -12,6 +12,10 @@ module BitbucketServer
def
self
.
decorate
(
entries
)
entries
.
map
{
|
entry
|
new
(
entry
)}
end
def
self
.
convert_timestamp
(
time_usec
)
Time
.
at
(
time_usec
/
1000
)
if
time_usec
.
is_a?
(
Integer
)
end
end
end
end
lib/bitbucket_server/representation/comment.rb
View file @
dd937377
...
...
@@ -40,11 +40,11 @@ module BitbucketServer
end
def
created_at
Time
.
at
(
created_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
self
.
class
.
convert_timestamp
(
created_date
)
end
def
updated_at
Time
.
at
(
updated_date
/
1000
)
if
updated_date
.
is_a?
(
Integer
)
self
.
class
.
convert_timestamp
(
created_date
)
end
# Bitbucket Server supports the ability to reply to any comment
...
...
lib/bitbucket_server/representation/pull_request.rb
View file @
dd937377
...
...
@@ -34,11 +34,11 @@ module BitbucketServer
end
def
created_at
Time
.
at
(
created_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
self
.
class
.
convert_timestamp
(
created_date
)
end
def
updated_at
Time
.
at
(
updated_date
/
1000
)
if
created_date
.
is_a?
(
Integer
)
self
.
class
.
convert_timestamp
(
updated_date
)
end
def
title
...
...
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