Commit ca9ae8bf authored by James Lopez's avatar James Lopez

add email to user related queries so it can be used for displaying avatar in the UI

parent 32679232
class Projects::CycleAnalytics::EventsController < Projects::ApplicationController
#before_action :authorize_read_cycle_analytics!
# before_action :authorize_read_cycle_analytics!
def issue
render_events(events.issue_events)
......
......@@ -10,7 +10,6 @@ module Gitlab
end
# TODO: backend pagination - specially for commits, etc...
# TODO figure out what the frontend needs for displaying the avatar
def issue_events
@fetcher.fetch(stage: :issue).each { |event| parse_event(event) }
......
......@@ -8,7 +8,7 @@ module Gitlab
start_time_attrs: issue_table[:created_at],
end_time_attrs: [issue_metrics_table[:first_associated_with_milestone_at],
issue_metrics_table[:first_added_to_board_at]],
projections: [issue_table[:title], issue_table[:iid], issue_table[:created_at], user_table[:name]]
projections: [issue_table[:title], issue_table[:iid], issue_table[:created_at], user_table[:name], user_table[:email]]
},
plan: {
start_time_attrs: issue_metrics_table[:first_associated_with_milestone_at],
......@@ -19,7 +19,7 @@ module Gitlab
code: {
start_time_attrs: issue_metrics_table[:first_mentioned_in_commit_at],
end_time_attrs: mr_table[:created_at],
projections: [mr_table[:title], mr_table[:iid], mr_table[:created_at], user_table[:name]],
projections: [mr_table[:title], mr_table[:iid], mr_table[:created_at], user_table[:name], user_table[:email]],
order: mr_table[:created_at]
},
test: {
......@@ -31,7 +31,7 @@ module Gitlab
review: {
start_time_attrs: mr_table[:created_at],
end_time_attrs: mr_metrics_table[:merged_at],
projections: [mr_table[:title], mr_table[:iid], mr_table[:created_at], user_table[:name]]
projections: [mr_table[:title], mr_table[:iid], mr_table[:created_at], user_table[:name], user_table[:email]]
},
staging: {
start_time_attrs: mr_metrics_table[:merged_at],
......@@ -41,7 +41,7 @@ module Gitlab
production: {
start_time_attrs: issue_table[:created_at],
end_time_attrs: mr_metrics_table[:first_deployed_to_production_at],
projections: [issue_table[:title], issue_table[:iid], issue_table[:created_at], user_table[:name]]
projections: [issue_table[:title], issue_table[:iid], issue_table[:created_at], user_table[:name], user_table[:email]]
},
}.freeze
......
......@@ -30,6 +30,10 @@ describe Gitlab::CycleAnalytics::Events do
expect(subject.issue_events.first['created_at']).to end_with('ago')
end
it "has the author's email" do
expect(subject.issue_events.first['email']).to eq(context.author.email)
end
it "has the author's name" do
expect(subject.issue_events.first['name']).to eq(context.author.name)
end
......@@ -70,6 +74,10 @@ describe Gitlab::CycleAnalytics::Events do
expect(subject.code_events.first['created_at']).to end_with('ago')
end
it "has the author's email" do
expect(subject.code_events.first['email']).to eq(context.author.email)
end
it "has the author's name" do
expect(subject.code_events.first['name']).to eq(context.author.name)
end
......@@ -118,6 +126,10 @@ describe Gitlab::CycleAnalytics::Events do
expect(subject.review_events.first['created_at']).to end_with('ago')
end
it "has the author's email" do
expect(subject.review_events.first['email']).to eq(MergeRequest.first.author.email)
end
it "has the author's name" do
expect(subject.review_events.first['name']).to eq(MergeRequest.first.author.name)
end
......@@ -173,6 +185,10 @@ describe Gitlab::CycleAnalytics::Events do
expect(subject.production_events.first['created_at']).to end_with('ago')
end
it "has the author's email" do
expect(subject.production_events.first['email']).to eq(context.author.email)
end
it "has the author's name" do
expect(subject.production_events.first['name']).to eq(context.author.name)
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