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,40 +230,61 @@ 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_selector('.vue-filtered-search-bar-container')
expect(page.find('.issuable-list')).to have_selector('li.issue', count: 3)
end
end
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)
it 'renders epics item with metadata', :aggregate_failures do
page.within('.issuable-list-container .issuable-list') do
expect(page.all('.issuable-info-container')[0].find('.issue-title')).to have_content(epic2.title)
expect(page.all('.issuable-info-container')[0].find('.issuable-reference')).to have_content("&#{epic2.iid}")
expect(page.all('.issuable-info-container')[0].find('.issuable-authored')).to have_content('created')
expect(page.all('.issuable-info-container')[0].find('.issuable-authored')).to have_content("by #{epic2.author.name}")
end
end
end
it 'renders epics item with metadata', :aggregate_failures do
page.within('.issuable-list-container .issuable-list') do
expect(page.all('.issuable-info-container')[0].find('.issue-title')).to have_content(epic2.title)
expect(page.all('.issuable-info-container')[0].find('.issuable-reference')).to have_content("&#{epic2.iid}")
expect(page.all('.issuable-info-container')[0].find('.issuable-authored')).to have_content('created')
expect(page.all('.issuable-info-container')[0].find('.issuable-authored')).to have_content("by #{epic2.author.name}")
it 'renders epic item timeframe', :aggregate_failures do
page.within('.issuable-list-container .issuable-list') do
expect(page.all('.issuable-info-container')[0].find('.issuable-info')).to have_content('Dec 15, 2020 – No due date')
expect(page.all('.issuable-info-container')[1].find('.issuable-info')).to have_content('Dec 15, 2020 – Jan 15, 2021')
expect(page.all('.issuable-info-container')[2].find('.issuable-info')).to have_content('No start date – Jan 15, 2021')
end
end
end
it 'renders epic item timeframe', :aggregate_failures do
page.within('.issuable-list-container .issuable-list') do
expect(page.all('.issuable-info-container')[0].find('.issuable-info')).to have_content('Dec 15, 2020 – No due date')
expect(page.all('.issuable-info-container')[1].find('.issuable-info')).to have_content('Dec 15, 2020 – Jan 15, 2021')
expect(page.all('.issuable-info-container')[2].find('.issuable-info')).to have_content('No start date – Jan 15, 2021')
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
it_behaves_like 'filtered search bar', available_tokens
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
......
......@@ -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