Commit 872c26b6 authored by Stan Hu's avatar Stan Hu

Merge branch...

Merge branch '338585-visiting-epic-boards-in-public-groups-as-a-non-logged-in-user-can-fail' into 'master'

Logged out users can view public group epic boards

See merge request gitlab-org/gitlab!69218
parents a0d3be0c a067f751
......@@ -20,7 +20,7 @@ module Boards
def execute
super.tap do |response|
if response.success?
track_usage_event(:g_project_management_users_creating_epic_boards, current_user.id)
track_usage_event(:g_project_management_users_creating_epic_boards, current_user&.id)
end
end
end
......
......@@ -75,6 +75,24 @@ RSpec.describe Groups::EpicBoardsController do
end
end
context 'with non-logged-in user and public group' do
let_it_be(:group) { create(:group, :public) }
before do
sign_out(user)
end
it 'creates a new board when group does not have one' do
expect { list_boards }.to change(group.epic_boards, :count).by(1)
end
it 'returns a 200 response' do
list_boards
expect(response).to have_gitlab_http_status(:ok)
end
end
context 'json request' do
it 'is not supported' do
list_boards(format: :json)
......
......@@ -14,11 +14,22 @@ RSpec.describe Boards::EpicBoards::CreateService, services: true do
context 'create epic board' do
it_behaves_like 'create a board', :epic_boards
it 'tracks epic board creation' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.to receive(:track_event).with('g_project_management_users_creating_epic_boards', values: user.id)
context 'when logged in' do
it 'tracks epic board creation' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.to receive(:track_event).with('g_project_management_users_creating_epic_boards', values: user.id)
described_class.new(parent, user).execute
described_class.new(parent, user).execute
end
end
context 'when not logged in' do
it 'tracks epic board creation' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.to receive(:track_event).with('g_project_management_users_creating_epic_boards', values: nil)
described_class.new(parent, nil).execute
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