Commit 91884ccd authored by Adam Hegyi's avatar Adam Hegyi

Show promotions on CA page

This change will show the Contribution Analytics promotion page for
users who has no permission to see the selected group's Contribution
Analytics page.
parent 65f3749c
---
title: Show the Contribution Analytics promotion page for users without permission
merge_request: 57222
author:
type: changed
...@@ -40,7 +40,7 @@ class Groups::ContributionAnalyticsController < Groups::ApplicationController ...@@ -40,7 +40,7 @@ class Groups::ContributionAnalyticsController < Groups::ApplicationController
end end
def authorize_read_contribution_analytics! def authorize_read_contribution_analytics!
render_403 unless user_has_access_to_feature? render_promotion unless user_has_access_to_feature?
end end
def render_promotion def render_promotion
......
...@@ -3,14 +3,15 @@ ...@@ -3,14 +3,15 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Groups::ContributionAnalyticsController do RSpec.describe Groups::ContributionAnalyticsController do
let(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
let(:user3) { create(:user) } let_it_be(:user3) { create(:user) }
let(:guest_user) { create(:user) } let_it_be(:guest_user) { create(:user) }
let(:group) { create(:group) } let_it_be(:group) { create(:group) }
let(:project) { create(:project, :repository, group: group) } let_it_be(:project) { create(:project, :repository, group: group) }
let(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) } let_it_be(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:push_data) { Gitlab::DataBuilder::Push.build_sample(project, user) } let(:push_data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
def create_event(author, project, target, action) def create_event(author, project, target, action)
...@@ -71,7 +72,8 @@ RSpec.describe Groups::ContributionAnalyticsController do ...@@ -71,7 +72,8 @@ RSpec.describe Groups::ContributionAnalyticsController do
it 'renders 403' do it 'renders 403' do
request request
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to render_template(
'shared/promotions/_promote_contribution_analytics')
end end
end end
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