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