From 86fccaa4bceb0b3dfb5de67a4390b469d5551fe3 Mon Sep 17 00:00:00 2001 From: Kushal Pandya Date: Wed, 20 Mar 2019 18:47:36 +0530 Subject: [PATCH 1/3] Fix a bug where fixed date change is not reflected Fixes a bug where changing epic start/finish date with type fixed is not reflected on UI immediately and requires user to refresh the page. --- .../javascripts/epic/store/mutations.js | 8 +++++ .../javascripts/epic/store/mutationts_spec.js | 30 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/ee/app/assets/javascripts/epic/store/mutations.js b/ee/app/assets/javascripts/epic/store/mutations.js index c52143222fe663..3dc00aeea1e54a 100644 --- a/ee/app/assets/javascripts/epic/store/mutations.js +++ b/ee/app/assets/javascripts/epic/store/mutations.js @@ -58,10 +58,18 @@ export default { state.epicStartDateSaveInProgress = false; state.startDateIsFixed = dateTypeIsFixed; state.startDate = newDate; + + if (dateTypeIsFixed) { + state.startDateFixed = newDate; + } } else { state.epicDueDateSaveInProgress = false; state.dueDateIsFixed = dateTypeIsFixed; state.dueDate = newDate; + + if (dateTypeIsFixed) { + state.dueDateFixed = newDate; + } } }, [types.REQUEST_EPIC_DATE_SAVE_FAILURE](state, { dateType, dateTypeIsFixed }) { diff --git a/ee/spec/javascripts/epic/store/mutationts_spec.js b/ee/spec/javascripts/epic/store/mutationts_spec.js index 7bb0c02095b7f9..d979b24e074cac 100644 --- a/ee/spec/javascripts/epic/store/mutationts_spec.js +++ b/ee/spec/javascripts/epic/store/mutationts_spec.js @@ -189,6 +189,7 @@ describe('Epic Store Mutations', () => { expect(state.epicStartDateSaveInProgress).toBe(false); expect(state.startDateIsFixed).toBe(startDateIsFixed); expect(state.startDate).toBe(startDate); + expect(state.startDateFixed).toBe(startDate); }); it('Should set `epicDueDateSaveInProgress` flag on state to `false` and set `dueDateIsFixed` & `dueDate` values based on provided `dateTypeIsFixed` & `newDate` params when `dateType` param is `due`', () => { @@ -205,6 +206,35 @@ describe('Epic Store Mutations', () => { expect(state.epicDueDateSaveInProgress).toBe(false); expect(state.dueDateIsFixed).toBe(dueDateIsFixed); expect(state.dueDate).toBe(dueDate); + expect(state.dueDateFixed).toBe(dueDate); + }); + + it('Should not set `startDateFixed` on state when date changed is not of type fixed', () => { + const startDateIsFixed = false; + const startDate = '2018-1-1'; + const state = {}; + + mutations[types.REQUEST_EPIC_DATE_SAVE_SUCCESS](state, { + dateType: dateTypes.start, + dateTypeIsFixed: startDateIsFixed, + newDate: startDate, + }); + + expect(state.startDateFixed).toBeUndefined(); + }); + + it('Should not set `dueDateFixed` on state when date changed is not of type fixed', () => { + const dueDateIsFixed = false; + const dueDate = '2018-1-1'; + const state = {}; + + mutations[types.REQUEST_EPIC_DATE_SAVE_SUCCESS](state, { + dateType: dateTypes.due, + dateTypeIsFixed: dueDateIsFixed, + newDate: dueDate, + }); + + expect(state.dueDateFixed).toBeUndefined(); }); }); -- GitLab From 4e0ee5b3422fdf1e40313a1d0b3efea75c90b6ff Mon Sep 17 00:00:00 2001 From: Kushal Pandya Date: Wed, 20 Mar 2019 18:49:41 +0530 Subject: [PATCH 2/3] Fix date remove button alignment --- .../epic/components/sidebar_items/sidebar_date_picker.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/app/assets/javascripts/epic/components/sidebar_items/sidebar_date_picker.vue b/ee/app/assets/javascripts/epic/components/sidebar_items/sidebar_date_picker.vue index 57833b7e2d9bb2..8f03444b79f916 100644 --- a/ee/app/assets/javascripts/epic/components/sidebar_items/sidebar_date_picker.vue +++ b/ee/app/assets/javascripts/epic/components/sidebar_items/sidebar_date_picker.vue @@ -246,8 +246,8 @@ export default { css-classes="date-warning-icon append-right-5 prepend-left-5" tab-index="0" /> - -  – + +  –  Date: Wed, 20 Mar 2019 18:53:24 +0530 Subject: [PATCH 3/3] Add changelog entry --- ee/changelogs/unreleased/10543-fix-epic-date-save.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 ee/changelogs/unreleased/10543-fix-epic-date-save.yml diff --git a/ee/changelogs/unreleased/10543-fix-epic-date-save.yml b/ee/changelogs/unreleased/10543-fix-epic-date-save.yml new file mode 100644 index 00000000000000..0687c8226881ab --- /dev/null +++ b/ee/changelogs/unreleased/10543-fix-epic-date-save.yml @@ -0,0 +1,5 @@ +--- +title: Fix date save for Epic to reflect on UI immediately after save +merge_request: 10321 +author: +type: fixed -- GitLab