Commit 6a3907f6 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'ali/add-user-to-standard-context' into 'master'

Add user to StandardContext

See merge request gitlab-org/gitlab!52534
parents 4b828727 354f43dc
......@@ -32,8 +32,10 @@ module Epics
end
def track_event
context = ::Gitlab::Tracking::StandardContext.new(namespace: @parent_group, project: issue.project, user: current_user)
::Gitlab::Tracking.event('epics', 'promote', property: 'issue_id', value: original_entity.id,
standard_context: ::Gitlab::Tracking::StandardContext.new(namespace: @parent_group, project: issue.project))
standard_context: context)
end
def create_new_entity
......
......@@ -65,7 +65,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
subject.execute(issue)
expect_snowplow_event(category: 'epics', action: 'promote', property: 'issue_id', value: issue.id,
standard_context: { namespace: group, project: project })
standard_context: { namespace: group, project: project, user: user })
end
it 'creates a new epic with correct attributes' do
......@@ -201,7 +201,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
expect(epic.notes.where(discussion_id: discussion.discussion_id).count).to eq(0)
expect(issue.notes.where(discussion_id: discussion.discussion_id).count).to eq(1)
expect_snowplow_event(category: 'epics', action: 'promote', property: 'issue_id', value: issue.id,
standard_context: { namespace: group, project: project })
standard_context: { namespace: group, project: project, user: user })
end
it 'copies note attachments' do
......@@ -211,7 +211,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
expect(epic.notes.user.first.attachment).to be_kind_of(AttachmentUploader)
expect_snowplow_event(category: 'epics', action: 'promote', property: 'issue_id', value: issue.id,
standard_context: { namespace: group, project: project })
standard_context: { namespace: group, project: project, user: user })
end
end
......
......@@ -5,9 +5,7 @@ module Gitlab
class StandardContext
GITLAB_STANDARD_SCHEMA_URL = 'iglu:com.gitlab/gitlab_standard/jsonschema/1-0-2'.freeze
def initialize(namespace: nil, project: nil, **data)
@namespace = namespace
@project = project
def initialize(namespace: nil, project: nil, user: nil, **data)
@data = data
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment