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