Commit 1aa3f814 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch 'ss/fix-epics-list-when-logged-out' into 'master'

Fix epic list rendering when user is logged out

See merge request gitlab-org/gitlab!66098
parents 3c0071e2 8e5ab875
......@@ -42,6 +42,7 @@ export default {
'groupLabelsPath',
'groupMilestonesPath',
'emptyStatePath',
'isSignedIn',
],
apollo: {
epics: {
......@@ -50,6 +51,7 @@ export default {
const queryVariables = {
groupPath: this.groupFullPath,
state: this.currentState,
isSignedIn: this.isSignedIn,
};
if (this.prevPageCursor) {
......
......@@ -39,6 +39,7 @@ export default function initEpicsList({ mountPointSelector }) {
groupLabelsPath,
groupMilestonesPath,
emptyStatePath,
isSignedIn,
} = mountPointEl.dataset;
// eslint-disable-next-line import/no-deprecated
......@@ -76,6 +77,7 @@ export default function initEpicsList({ mountPointSelector }) {
groupLabelsPath,
groupMilestonesPath,
emptyStatePath,
isSignedIn: parseBoolean(isSignedIn),
},
render: (createElement) =>
createElement(EpicsListApp, {
......
......@@ -16,6 +16,7 @@ query groupEpics(
$lastPageSize: Int
$prevPageCursor: String = ""
$nextPageCursor: String = ""
$isSignedIn: Boolean = false
) {
group(fullPath: $groupPath) {
epics(
......@@ -41,7 +42,7 @@ query groupEpics(
startDate
dueDate
webUrl
userDiscussionsCount
userDiscussionsCount @include(if: $isSignedIn)
confidential
group {
fullPath
......
- @can_bulk_update = can?(current_user, :admin_epic, @group) && @group.licensed_feature_available?(:group_bulk_edit)
- page_title _("Epics")
- is_signed_in = current_user.present?.to_s
- if Feature.enabled?(:vue_epics_list, @group)
#js-epics-list{ data: { can_create_epic: can?(current_user, :create_epic, @group).to_s,
......@@ -18,7 +19,8 @@
group_full_path: @group.full_path,
group_labels_path: group_labels_path(@group, format: :json),
group_milestones_path: group_milestones_path(@group, format: :json),
empty_state_path: image_path('illustrations/epics/list.svg') } }
empty_state_path: image_path('illustrations/epics/list.svg'),
is_signed_in: is_signed_in } }
- else
.top-area
= render 'shared/issuable/epic_nav', type: :epics
......
......@@ -230,17 +230,10 @@ RSpec.describe 'epics list', :js do
let!(:epic3) { create(:epic, group: group, end_date: '2021-1-15') }
let!(:award_emoji_star) { create(:award_emoji, name: 'star', user: user, awardable: epic1) }
before do
group.add_developer(user)
group.add_developer(user_dev)
visit group_epics_path(group)
wait_for_requests
end
shared_examples 'epic list' do
it 'renders epics list', :aggregate_failures do
page.within('.issuable-list-container') do
expect(page).to have_selector('.gl-tabs')
expect(page).to have_link('New epic')
expect(page).to have_selector('.vue-filtered-search-bar-container')
expect(page.find('.issuable-list')).to have_selector('li.issue', count: 3)
end
......@@ -262,10 +255,38 @@ RSpec.describe 'epics list', :js do
expect(page.all('.issuable-info-container')[2].find('.issuable-info')).to have_content('No start date – Jan 15, 2021')
end
end
end
context 'when signed in' do
before do
group.add_developer(user)
group.add_developer(user_dev)
visit group_epics_path(group)
wait_for_requests
end
it 'renders New Epic Link' do
page.within('.issuable-list-container') do
expect(page).to have_link('New epic')
end
end
it_behaves_like 'epic list'
it_behaves_like 'filtered search bar', available_tokens
end
context 'when signed out' do
before do
sign_out user
visit group_epics_path(group)
wait_for_requests
end
it_behaves_like 'epic list'
end
end
describe 'within a sub-group group' do
let!(:subgroup) { create(:group, parent: group, name: 'subgroup') }
let!(:sub_epic1) { create(:epic, group: subgroup, start_date: '2020-12-15', end_date: '2021-1-15') }
......
......@@ -56,6 +56,7 @@ const mockProvide = {
groupMilestonesPath: '/gitlab-org/-/milestone.json',
listEpicsPath: '/gitlab-org/-/epics',
emptyStatePath: '/assets/illustrations/empty-state/epics.svg',
isSignedIn: false,
};
const mockPageInfo = {
......
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