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