Commit 5bb02fa6 authored by Eulyeon Ko's avatar Eulyeon Ko

Fix ce boards bugs

- 'moveItem' action should forward any payload it receives
when dispatching 'moveIssue'
- when creating a new issue in board_new_issue.vue,
"weight" should not be included for create issue mutation.
(weight is a gitlab preimum feature since 13.9)
parent e9ed3588
......@@ -2,6 +2,7 @@
import { GlButton } from '@gitlab/ui';
import { mapActions, mapGetters, mapState } from 'vuex';
import { getMilestone } from 'ee_else_ce/boards/boards_util';
import BoardNewIssueMixin from 'ee_else_ce/boards/mixins/board_new_issue';
import { __ } from '~/locale';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import eventHub from '../eventhub';
......@@ -17,8 +18,8 @@ export default {
ProjectSelect,
GlButton,
},
mixins: [glFeatureFlagMixin()],
inject: ['groupId', 'weightFeatureAvailable', 'boardWeight'],
mixins: [glFeatureFlagMixin(), BoardNewIssueMixin],
inject: ['groupId'],
props: {
list: {
type: Object,
......@@ -53,14 +54,11 @@ export default {
submit(e) {
e.preventDefault();
const { title } = this;
const labels = this.list.label ? [this.list.label] : [];
const assignees = this.list.assignee ? [this.list.assignee] : [];
const milestone = getMilestone(this.list);
const weight = this.weightFeatureAvailable ? this.boardWeight : undefined;
const { title } = this;
eventHub.$emit(`scroll-board-list-${this.list.id}`);
return this.addListNewIssue({
......@@ -70,7 +68,7 @@ export default {
assigneeIds: assignees?.map((a) => a?.id),
milestoneId: milestone?.id,
projectPath: this.selectedProject.fullPath,
weight: weight >= 0 ? weight : null,
...this.extraIssueInput(),
},
list: this.list,
}).then(() => {
......
export default {
// EE-only
methods: {
extraIssueInput: () => {},
},
};
......@@ -327,8 +327,8 @@ export default {
commit(types.RESET_ISSUES);
},
moveItem: ({ dispatch }) => {
dispatch('moveIssue');
moveItem: ({ dispatch }, payload) => {
dispatch('moveIssue', payload);
},
moveIssue: (
......
export default {
inject: ['groupId', 'weightFeatureAvailable', 'boardWeight'],
methods: {
extraIssueInput() {
if (this.weightFeatureAvailable) {
return {
weight: this.boardWeight >= 0 ? this.boardWeight : null,
};
}
return {};
},
},
};
......@@ -639,10 +639,13 @@ describe('resetIssues', () => {
});
describe('moveItem', () => {
it('should dispatch moveIssue action', () => {
it('should dispatch moveIssue action with payload', () => {
const payload = { mock: 'payload' };
testAction({
action: actions.moveItem,
expectedActions: [{ type: 'moveIssue' }],
payload,
expectedActions: [{ type: 'moveIssue', payload }],
});
});
});
......
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