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
747e5c3b
Commit
747e5c3b
authored
Nov 15, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use request to pass extra parameters
parent
6a2737e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
7 deletions
+6
-7
app/serializers/analytics_generic_entity.rb
app/serializers/analytics_generic_entity.rb
+1
-1
lib/gitlab/cycle_analytics/events.rb
lib/gitlab/cycle_analytics/events.rb
+2
-2
spec/serializers/analytics_generic_entity_spec.rb
spec/serializers/analytics_generic_entity_spec.rb
+2
-2
spec/serializers/analytics_generic_serializer_spec.rb
spec/serializers/analytics_generic_serializer_spec.rb
+1
-2
No files found.
app/serializers/analytics_generic_entity.rb
View file @
747e5c3b
...
@@ -17,7 +17,7 @@ class AnalyticsGenericEntity < Grape::Entity
...
@@ -17,7 +17,7 @@ class AnalyticsGenericEntity < Grape::Entity
end
end
expose
:url
do
|
object
|
expose
:url
do
|
object
|
url_to
(
"namespace_project_
#{
object
[
:entity
]
}
"
.
to_sym
,
id:
object
[
:iid
].
to_s
)
url_to
(
"namespace_project_
#{
request
.
entity
}
"
.
to_sym
,
id:
object
[
:iid
].
to_s
)
end
end
private
private
...
...
lib/gitlab/cycle_analytics/events.rb
View file @
747e5c3b
...
@@ -49,10 +49,10 @@ module Gitlab
...
@@ -49,10 +49,10 @@ module Gitlab
private
private
def
parse_event
(
event
)
def
parse_event
(
event
,
entity: :issue
)
event
[
'author'
]
=
User
.
find
(
event
.
remove
(
'author_id'
))
event
[
'author'
]
=
User
.
find
(
event
.
remove
(
'author_id'
))
AnalyticsGenericSerializer
.
new
(
project:
@project
).
represent
(
event
).
as_json
AnalyticsGenericSerializer
.
new
(
project:
@project
,
entity:
entity
).
represent
(
event
).
as_json
end
end
def
parse_build_event
(
event
)
def
parse_build_event
(
event
)
...
...
spec/serializers/analytics_generic_entity_spec.rb
View file @
747e5c3b
...
@@ -10,14 +10,14 @@ describe AnalyticsGenericEntity do
...
@@ -10,14 +10,14 @@ describe AnalyticsGenericEntity do
id:
"1"
,
id:
"1"
,
created_at:
"2016-11-12 15:04:02.948604"
,
created_at:
"2016-11-12 15:04:02.948604"
,
author:
user
,
author:
user
,
entity: :merge_request
}
}
}
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:request
)
{
EntityRequest
.
new
(
project:
project
,
entity: :merge_request
)
}
let
(
:entity
)
do
let
(
:entity
)
do
described_class
.
new
(
entity_hash
,
request:
double
,
project:
project
)
described_class
.
new
(
entity_hash
,
request:
request
,
project:
project
)
end
end
context
'generic entity'
do
context
'generic entity'
do
...
...
spec/serializers/analytics_generic_serializer_spec.rb
View file @
747e5c3b
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
AnalyticsGenericSerializer
do
describe
AnalyticsGenericSerializer
do
let
(
:serializer
)
do
let
(
:serializer
)
do
described_class
described_class
.
new
(
project:
project
)
.
new
(
project:
project
,
entity: :merge_request
)
.
represent
(
resource
)
.
represent
(
resource
)
end
end
...
@@ -18,7 +18,6 @@ describe AnalyticsGenericSerializer do
...
@@ -18,7 +18,6 @@ describe AnalyticsGenericSerializer do
id:
"1"
,
id:
"1"
,
created_at:
"2016-11-12 15:04:02.948604"
,
created_at:
"2016-11-12 15:04:02.948604"
,
author:
user
,
author:
user
,
entity: :merge_request
}
}
}
}
...
...
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