add email to user related queries so it can be used for displaying avatar in the UI
This commit is contained in:
parent
3267923263
commit
ca9ae8bf63
|
@ -1,5 +1,5 @@
|
|||
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)
|
||||
|
@ -41,12 +41,12 @@ class Projects::CycleAnalytics::EventsController < Projects::ApplicationControll
|
|||
# TODO refactor this
|
||||
def start_date
|
||||
case events_params[:start_date]
|
||||
when '30' then
|
||||
30.days.ago
|
||||
when '90' then
|
||||
90.days.ago
|
||||
else
|
||||
90.days.ago
|
||||
when '30' then
|
||||
30.days.ago
|
||||
when '90' then
|
||||
90.days.ago
|
||||
else
|
||||
90.days.ago
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -59,4 +59,4 @@ class Projects::CycleAnalytics::EventsController < Projects::ApplicationControll
|
|||
|
||||
{ start_date: params[:events][:start_date] }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue