Commit a6b74a6c authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch...

Merge branch '295626-when-epic-swimlanes-are-enabled-milestones-are-incorrectly-scoped-in-boards-sidebar' into 'master'

Scope milestones on swimlane boards to project and its ancestors [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!52199
parents d8f2b0d5 dc9c6864
......@@ -8,9 +8,8 @@ import {
GlDropdownDivider,
GlLoadingIcon,
} from '@gitlab/ui';
import { fetchPolicies } from '~/lib/graphql';
import BoardEditableItem from '~/boards/components/sidebar/board_editable_item.vue';
import groupMilestones from '../../graphql/group_milestones.query.graphql';
import projectMilestones from '../../graphql/project_milestones.query.graphql';
import createFlash from '~/flash';
import { __, s__ } from '~/locale';
......@@ -34,22 +33,21 @@ export default {
},
apollo: {
milestones: {
fetchPolicy: fetchPolicies.CACHE_AND_NETWORK,
query: groupMilestones,
query: projectMilestones,
debounce: 250,
skip() {
return !this.edit;
},
variables() {
return {
fullPath: this.groupFullPath,
fullPath: this.projectPath,
searchTitle: this.searchTitle,
state: 'active',
includeDescendants: true,
includeAncestors: true,
};
},
update(data) {
const edges = data?.group?.milestones?.edges ?? [];
const edges = data?.project?.milestones?.edges ?? [];
return edges.map((item) => item.node);
},
error() {
......
query groupMilestones(
$fullPath: ID!
$state: MilestoneStateEnum
$includeDescendants: Boolean
$includeAncestors: Boolean
$searchTitle: String
) {
group(fullPath: $fullPath) {
milestones(state: $state, includeDescendants: $includeDescendants, searchTitle: $searchTitle) {
project(fullPath: $fullPath) {
milestones(state: $state, includeAncestors: $includeAncestors, searchTitle: $searchTitle) {
edges {
node {
id
......
---
title: Scope milestones on swimlane boards to project and its ancestors
merge_request: 52199
author:
type: fixed
......@@ -20,7 +20,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () =>
wrapper = null;
});
const createWrapper = ({ milestone = null } = {}) => {
const createWrapper = ({ milestone = null, loading = false } = {}) => {
store = createStore();
store.state.issues = { [TEST_ISSUE.id]: { ...TEST_ISSUE, milestone } };
store.state.activeId = TEST_ISSUE.id;
......@@ -38,7 +38,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () =>
},
mocks: {
$apollo: {
loading: false,
loading,
},
},
});
......@@ -63,12 +63,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () =>
});
it('shows loader while Apollo is loading', async () => {
createWrapper({ milestone: TEST_MILESTONE });
expect(findLoader().exists()).toBe(false);
wrapper.vm.$apollo.loading = true;
await wrapper.vm.$nextTick();
createWrapper({ milestone: TEST_MILESTONE, loading: true });
expect(findLoader().exists()).toBe(true);
});
......@@ -76,8 +71,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () =>
it('shows message when error or no milestones found', async () => {
createWrapper();
wrapper.setData({ milestones: [] });
await wrapper.vm.$nextTick();
await wrapper.setData({ milestones: [] });
expect(findNoMilestonesFoundItem().text()).toBe('No milestones found');
});
......
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