summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/mutations/file.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/ide/stores/mutations/file.js')
-rw-r--r--app/assets/javascripts/ide/stores/mutations/file.js46
1 files changed, 23 insertions, 23 deletions
diff --git a/app/assets/javascripts/ide/stores/mutations/file.js b/app/assets/javascripts/ide/stores/mutations/file.js
index 61a55d45128..4446971d5d6 100644
--- a/app/assets/javascripts/ide/stores/mutations/file.js
+++ b/app/assets/javascripts/ide/stores/mutations/file.js
@@ -12,7 +12,7 @@ export default {
if (active && !state.entries[path].pending) {
Object.assign(state, {
- openFiles: state.openFiles.map(f =>
+ openFiles: state.openFiles.map((f) =>
Object.assign(f, { active: f.pending ? false : f.active }),
),
});
@@ -28,21 +28,21 @@ export default {
if (entry.opened) {
Object.assign(state, {
- openFiles: state.openFiles.filter(f => f.path !== path).concat(state.entries[path]),
+ openFiles: state.openFiles.filter((f) => f.path !== path).concat(state.entries[path]),
});
} else {
Object.assign(state, {
- openFiles: state.openFiles.filter(f => f.key !== entry.key),
+ openFiles: state.openFiles.filter((f) => f.key !== entry.key),
});
}
},
[types.SET_FILE_DATA](state, { data, file }) {
const stateEntry = state.entries[file.path];
- const stagedFile = state.stagedFiles.find(f => f.path === file.path);
- const openFile = state.openFiles.find(f => f.path === file.path);
- const changedFile = state.changedFiles.find(f => f.path === file.path);
+ const stagedFile = state.stagedFiles.find((f) => f.path === file.path);
+ const openFile = state.openFiles.find((f) => f.path === file.path);
+ const changedFile = state.changedFiles.find((f) => f.path === file.path);
- [stateEntry, stagedFile, openFile, changedFile].forEach(f => {
+ [stateEntry, stagedFile, openFile, changedFile].forEach((f) => {
if (f) {
Object.assign(
f,
@@ -57,10 +57,10 @@ export default {
},
[types.SET_FILE_RAW_DATA](state, { file, raw, fileDeletedAndReadded = false }) {
const openPendingFile = state.openFiles.find(
- f =>
+ (f) =>
f.path === file.path && f.pending && !(f.tempFile && !f.prevPath && !fileDeletedAndReadded),
);
- const stagedFile = state.stagedFiles.find(f => f.path === file.path);
+ const stagedFile = state.stagedFiles.find((f) => f.path === file.path);
if (file.tempFile && file.content === '' && !fileDeletedAndReadded) {
Object.assign(state.entries[file.path], { content: raw });
@@ -86,7 +86,7 @@ export default {
});
},
[types.UPDATE_FILE_CONTENT](state, { path, content }) {
- const stagedFile = state.stagedFiles.find(f => f.path === path);
+ const stagedFile = state.stagedFiles.find((f) => f.path === path);
const rawContent = stagedFile ? stagedFile.content : state.entries[path].raw;
const changed = content !== rawContent;
@@ -112,7 +112,7 @@ export default {
});
},
[types.DISCARD_FILE_CHANGES](state, path) {
- const stagedFile = state.stagedFiles.find(f => f.path === path);
+ const stagedFile = state.stagedFiles.find((f) => f.path === path);
const entry = state.entries[path];
const { deleted } = entry;
@@ -137,14 +137,14 @@ export default {
},
[types.REMOVE_FILE_FROM_CHANGED](state, path) {
Object.assign(state, {
- changedFiles: state.changedFiles.filter(f => f.path !== path),
+ changedFiles: state.changedFiles.filter((f) => f.path !== path),
});
},
[types.STAGE_CHANGE](state, { path, diffInfo }) {
- const stagedFile = state.stagedFiles.find(f => f.path === path);
+ const stagedFile = state.stagedFiles.find((f) => f.path === path);
Object.assign(state, {
- changedFiles: state.changedFiles.filter(f => f.path !== path),
+ changedFiles: state.changedFiles.filter((f) => f.path !== path),
entries: Object.assign(state.entries, {
[path]: Object.assign(state.entries[path], {
staged: diffInfo.exists,
@@ -162,12 +162,12 @@ export default {
}
if (!diffInfo.exists) {
- state.stagedFiles = state.stagedFiles.filter(f => f.path !== path);
+ state.stagedFiles = state.stagedFiles.filter((f) => f.path !== path);
}
},
[types.UNSTAGE_CHANGE](state, { path, diffInfo }) {
- const changedFile = state.changedFiles.find(f => f.path === path);
- const stagedFile = state.stagedFiles.find(f => f.path === path);
+ const changedFile = state.changedFiles.find((f) => f.path === path);
+ const stagedFile = state.stagedFiles.find((f) => f.path === path);
if (!changedFile && stagedFile) {
Object.assign(state.entries[path], {
@@ -182,11 +182,11 @@ export default {
}
if (!diffInfo.exists) {
- state.changedFiles = state.changedFiles.filter(f => f.path !== path);
+ state.changedFiles = state.changedFiles.filter((f) => f.path !== path);
}
Object.assign(state, {
- stagedFiles: state.stagedFiles.filter(f => f.path !== path),
+ stagedFiles: state.stagedFiles.filter((f) => f.path !== path),
entries: Object.assign(state.entries, {
[path]: Object.assign(state.entries[path], {
staged: false,
@@ -206,7 +206,7 @@ export default {
state.entries[file.path].opened = false;
state.entries[file.path].active = false;
state.entries[file.path].lastOpenedAt = new Date().getTime();
- state.openFiles.forEach(f =>
+ state.openFiles.forEach((f) =>
Object.assign(f, {
opened: false,
active: false,
@@ -224,13 +224,13 @@ export default {
},
[types.REMOVE_PENDING_TAB](state, file) {
Object.assign(state, {
- openFiles: state.openFiles.filter(f => f.key !== file.key),
+ openFiles: state.openFiles.filter((f) => f.key !== file.key),
});
},
[types.REMOVE_FILE_FROM_STAGED_AND_CHANGED](state, file) {
Object.assign(state, {
- changedFiles: state.changedFiles.filter(f => f.key !== file.key),
- stagedFiles: state.stagedFiles.filter(f => f.key !== file.key),
+ changedFiles: state.changedFiles.filter((f) => f.key !== file.key),
+ stagedFiles: state.stagedFiles.filter((f) => f.key !== file.key),
});
Object.assign(state.entries[file.path], {