Commit 73fbacef authored by David O'Regan's avatar David O'Regan

Merge branch 'fix-epic-boards-do-not-show-subepics-count' into 'master'

Correct check for displaying SubEpic counts on boards

See merge request gitlab-org/gitlab!65756
parents 4fc184f2 b9f49339
......@@ -35,13 +35,23 @@ export const addItemToList = ({ state, listId, itemId, moveBeforeId, moveAfterId
export default {
[mutationTypes.SET_INITIAL_BOARD_DATA](state, data) {
const { boardType, disabled, boardId, fullBoardId, fullPath, boardConfig, issuableType } = data;
const {
allowSubEpics,
boardConfig,
boardId,
boardType,
disabled,
fullBoardId,
fullPath,
issuableType,
} = data;
state.allowSubEpics = allowSubEpics;
state.boardConfig = boardConfig;
state.boardId = boardId;
state.fullBoardId = fullBoardId;
state.fullPath = fullPath;
state.boardType = boardType;
state.disabled = disabled;
state.boardConfig = boardConfig;
state.fullBoardId = fullBoardId;
state.fullPath = fullPath;
state.issuableType = issuableType;
},
......
......@@ -3,6 +3,7 @@ import createStateCE from '~/boards/stores/state';
export default () => ({
...createStateCE(),
allowSubEpics: false,
canAdminEpic: false,
isShowingEpicsSwimlanes: false,
epicsSwimlanesFetchInProgress: {
......
......@@ -93,6 +93,7 @@ export default () => {
return {
state: {},
loading: 0,
allowSubEpics: parseBoolean($boardApp.dataset.subEpicsFeatureAvailable),
boardsEndpoint: $boardApp.dataset.boardsEndpoint,
recentBoardsEndpoint: $boardApp.dataset.recentBoardsEndpoint,
listsEndpoint: $boardApp.dataset.listsEndpoint,
......@@ -107,6 +108,7 @@ export default () => {
},
created() {
this.setInitialBoardData({
allowSubEpics: this.allowSubEpics,
boardId: $boardApp.dataset.boardId,
fullBoardId: fullEpicBoardId($boardApp.dataset.boardId),
fullPath: $boardApp.dataset.fullPath,
......
......@@ -51,7 +51,8 @@ module EE
{
iteration_lists_available: current_board_namespace.feature_available?(:board_iteration_lists).to_s,
epic_feature_available: current_board_namespace.feature_available?(:epics).to_s,
iteration_feature_available: current_board_namespace.feature_available?(:iterations).to_s
iteration_feature_available: current_board_namespace.feature_available?(:iterations).to_s,
sub_epics_feature_available: current_board_namespace.feature_available?(:subepics).to_s
}
end
# rubocop:enable Metrics/AbcSize
......
......@@ -118,7 +118,8 @@ RSpec.describe BoardsHelper do
context "group-level licensed features" do
[[:board_iteration_lists, :iteration_lists_available],
[:epics, :epic_feature_available],
[:iterations, :iteration_feature_available]].each do |feature_name, feature_key|
[:iterations, :iteration_feature_available],
[:subepics, :sub_epics_feature_available]].each do |feature_name, feature_key|
include_examples "serializes the availability of a licensed feature", feature_name, feature_key
end
end
......
......@@ -35,6 +35,7 @@ describe('Board Store Mutations', () => {
describe('SET_INITIAL_BOARD_DATA', () => {
it('Should set initial Boards data to state', () => {
const allowSubEpics = true;
const boardId = 1;
const fullPath = 'gitlab-org';
const boardType = 'group';
......@@ -45,6 +46,7 @@ describe('Board Store Mutations', () => {
const issuableType = issuableTypes.issue;
mutations[types.SET_INITIAL_BOARD_DATA](state, {
allowSubEpics,
boardId,
fullPath,
boardType,
......@@ -53,6 +55,7 @@ describe('Board Store Mutations', () => {
issuableType,
});
expect(state.allowSubEpics).toBe(allowSubEpics);
expect(state.boardId).toEqual(boardId);
expect(state.fullPath).toEqual(fullPath);
expect(state.boardType).toEqual(boardType);
......
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