Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/ide/stores/actions.js')
-rw-r--r--app/assets/javascripts/ide/stores/actions.js36
1 files changed, 24 insertions, 12 deletions
diff --git a/app/assets/javascripts/ide/stores/actions.js b/app/assets/javascripts/ide/stores/actions.js
index 7a386299eed..66a89582da3 100644
--- a/app/assets/javascripts/ide/stores/actions.js
+++ b/app/assets/javascripts/ide/stores/actions.js
@@ -134,28 +134,40 @@ export const scrollToTab = () => {
});
};
-export const stageAllChanges = ({ state, commit, dispatch }) => {
+export const stageAllChanges = ({ state, commit, dispatch, getters }) => {
const openFile = state.openFiles[0];
commit(types.SET_LAST_COMMIT_MSG, '');
- state.changedFiles.forEach(file => commit(types.STAGE_CHANGE, file.path));
+ state.changedFiles.forEach(file =>
+ commit(types.STAGE_CHANGE, { path: file.path, diffInfo: getters.getDiffInfo(file.path) }),
+ );
- dispatch('openPendingTab', {
- file: state.stagedFiles.find(f => f.path === openFile.path),
- keyPrefix: stageKeys.staged,
- });
+ const file = getters.getStagedFile(openFile.path);
+
+ if (file) {
+ dispatch('openPendingTab', {
+ file,
+ keyPrefix: stageKeys.staged,
+ });
+ }
};
-export const unstageAllChanges = ({ state, commit, dispatch }) => {
+export const unstageAllChanges = ({ state, commit, dispatch, getters }) => {
const openFile = state.openFiles[0];
- state.stagedFiles.forEach(file => commit(types.UNSTAGE_CHANGE, file.path));
+ state.stagedFiles.forEach(file =>
+ commit(types.UNSTAGE_CHANGE, { path: file.path, diffInfo: getters.getDiffInfo(file.path) }),
+ );
- dispatch('openPendingTab', {
- file: state.changedFiles.find(f => f.path === openFile.path),
- keyPrefix: stageKeys.unstaged,
- });
+ const file = getters.getChangedFile(openFile.path);
+
+ if (file) {
+ dispatch('openPendingTab', {
+ file,
+ keyPrefix: stageKeys.unstaged,
+ });
+ }
};
export const updateViewer = ({ commit }, viewer) => {