summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-04-20 13:05:17 +0100
committerPhil Hughes <me@iamphill.com>2018-04-20 13:05:17 +0100
commit1e9b57a242a122fae642f88c995a2c411c4213f8 (patch)
tree1b08676b01c690dcc8517f560f5a0afe827263c3 /app/assets/javascripts/ide/stores
parentba3d5e655c9df89c31f70b7997a147218880096f (diff)
downloadgitlab-ce-1e9b57a242a122fae642f88c995a2c411c4213f8.tar.gz
updated code to use getter to get changedFile
Diffstat (limited to 'app/assets/javascripts/ide/stores')
-rw-r--r--app/assets/javascripts/ide/stores/getters.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/assets/javascripts/ide/stores/getters.js b/app/assets/javascripts/ide/stores/getters.js
index d1fd1b2b2ee..2e4129bcd48 100644
--- a/app/assets/javascripts/ide/stores/getters.js
+++ b/app/assets/javascripts/ide/stores/getters.js
@@ -42,15 +42,15 @@ export const collapseButtonTooltip = state =>
export const hasMergeRequest = state => !!state.currentMergeRequestId;
-export const getChangesInFolder = state => path => {
- const filePatchMatches = f => f.path.replace(new RegExp(`/${f.name}$`), '').indexOf(path) === 0;
- const changedFilesCount = state.changedFiles.filter(f => filePatchMatches(f)).length;
+export const getChangesInFolder = (state, getters) => path => {
+ const filePathMatches = f => f.path.replace(new RegExp(`/${f.name}$`), '').indexOf(path) === 0;
+ const changedFilesCount = state.changedFiles.filter(f => filePathMatches(f)).length;
const stagedFilesCount = state.stagedFiles.filter(
- f =>
- filePatchMatches(f) && !state.changedFiles.find(changedFile => changedFile.path === f.path),
+ f => filePathMatches(f) && !getters.getChangedFile(f.path),
).length;
return changedFilesCount + stagedFilesCount;
};
+export const getChangedFile = state => path => state.stagedFiles.find(f => f.path === path);
export const getStagedFile = state => path => state.stagedFiles.find(f => f.path === path);