summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 03:10:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 03:10:15 +0000
commitb908e6171374991b93fd9cb3949dcc65b5a713c2 (patch)
treef89dd0e7a509e67c4f022b70e0c7ed73bbb59892 /app/assets/javascripts/notes
parent5781a4966047232d4725f9ee4769c4bd5aed9b26 (diff)
downloadgitlab-ce-b908e6171374991b93fd9cb3949dcc65b5a713c2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r--app/assets/javascripts/notes/stores/actions.js15
-rw-r--r--app/assets/javascripts/notes/stores/getters.js2
-rw-r--r--app/assets/javascripts/notes/stores/modules/index.js2
-rw-r--r--app/assets/javascripts/notes/stores/mutations.js8
4 files changed, 15 insertions, 12 deletions
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js
index a4b9c64645c..2e6719bb4fb 100644
--- a/app/assets/javascripts/notes/stores/actions.js
+++ b/app/assets/javascripts/notes/stores/actions.js
@@ -515,7 +515,7 @@ export const removeConvertedDiscussion = ({ commit }, noteId) =>
export const setCurrentDiscussionId = ({ commit }, discussionId) =>
commit(types.SET_CURRENT_DISCUSSION_ID, discussionId);
-export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersion }) => {
+export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersion, versionId }) => {
let requestUrl = endpoint;
if (startingVersion) {
@@ -526,7 +526,7 @@ export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersio
return axios
.get(requestUrl)
.then(res => {
- dispatch('receiveDescriptionVersion', res.data);
+ dispatch('receiveDescriptionVersion', { descriptionVersion: res.data, versionId });
})
.catch(error => {
dispatch('receiveDescriptionVersionError', error);
@@ -544,7 +544,10 @@ export const receiveDescriptionVersionError = ({ commit }, error) => {
commit(types.RECEIVE_DESCRIPTION_VERSION_ERROR, error);
};
-export const softDeleteDescriptionVersion = ({ dispatch }, { endpoint, startingVersion }) => {
+export const softDeleteDescriptionVersion = (
+ { dispatch },
+ { endpoint, startingVersion, versionId },
+) => {
let requestUrl = endpoint;
if (startingVersion) {
@@ -555,7 +558,7 @@ export const softDeleteDescriptionVersion = ({ dispatch }, { endpoint, startingV
return axios
.delete(requestUrl)
.then(() => {
- dispatch('receiveDeleteDescriptionVersion');
+ dispatch('receiveDeleteDescriptionVersion', versionId);
})
.catch(error => {
dispatch('receiveDeleteDescriptionVersionError', error);
@@ -566,8 +569,8 @@ export const softDeleteDescriptionVersion = ({ dispatch }, { endpoint, startingV
export const requestDeleteDescriptionVersion = ({ commit }) => {
commit(types.REQUEST_DELETE_DESCRIPTION_VERSION);
};
-export const receiveDeleteDescriptionVersion = ({ commit }) => {
- commit(types.RECEIVE_DELETE_DESCRIPTION_VERSION, __('Deleted'));
+export const receiveDeleteDescriptionVersion = ({ commit }, versionId) => {
+ commit(types.RECEIVE_DELETE_DESCRIPTION_VERSION, { [versionId]: __('Deleted') });
};
export const receiveDeleteDescriptionVersionError = ({ commit }, error) => {
commit(types.RECEIVE_DELETE_DESCRIPTION_VERSION_ERROR, error);
diff --git a/app/assets/javascripts/notes/stores/getters.js b/app/assets/javascripts/notes/stores/getters.js
index 3a1e795cff4..28cc9cdd7e9 100644
--- a/app/assets/javascripts/notes/stores/getters.js
+++ b/app/assets/javascripts/notes/stores/getters.js
@@ -28,7 +28,7 @@ export const getUserData = state => state.userData || {};
export const getUserDataByProp = state => prop => state.userData && state.userData[prop];
-export const descriptionVersion = state => state.descriptionVersion;
+export const descriptionVersions = state => state.descriptionVersions;
export const notesById = state =>
state.discussions.reduce((acc, note) => {
diff --git a/app/assets/javascripts/notes/stores/modules/index.js b/app/assets/javascripts/notes/stores/modules/index.js
index 0e991f2f4f0..2d317dcd7da 100644
--- a/app/assets/javascripts/notes/stores/modules/index.js
+++ b/app/assets/javascripts/notes/stores/modules/index.js
@@ -28,7 +28,7 @@ export default () => ({
commentsDisabled: false,
resolvableDiscussionsCount: 0,
unresolvedDiscussionsCount: 0,
- descriptionVersion: null,
+ descriptionVersions: {},
},
actions,
getters,
diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js
index d32a88e4c71..c23ef93c056 100644
--- a/app/assets/javascripts/notes/stores/mutations.js
+++ b/app/assets/javascripts/notes/stores/mutations.js
@@ -288,9 +288,9 @@ export default {
[types.REQUEST_DESCRIPTION_VERSION](state) {
state.isLoadingDescriptionVersion = true;
},
- [types.RECEIVE_DESCRIPTION_VERSION](state, descriptionVersion) {
- state.isLoadingDescriptionVersion = false;
- state.descriptionVersion = descriptionVersion;
+ [types.RECEIVE_DESCRIPTION_VERSION](state, { descriptionVersion, versionId }) {
+ const descriptionVersions = { ...state.descriptionVersions, [versionId]: descriptionVersion };
+ Object.assign(state, { descriptionVersions, isLoadingDescriptionVersion: false });
},
[types.RECEIVE_DESCRIPTION_VERSION_ERROR](state) {
state.isLoadingDescriptionVersion = false;
@@ -300,7 +300,7 @@ export default {
},
[types.RECEIVE_DELETE_DESCRIPTION_VERSION](state, descriptionVersion) {
state.isLoadingDescriptionVersion = false;
- state.descriptionVersion = descriptionVersion;
+ Object.assign(state.descriptionVersions, descriptionVersion);
},
[types.RECEIVE_DELETE_DESCRIPTION_VERSION_ERROR](state) {
state.isLoadingDescriptionVersion = false;