2020-09-01 05:10:28 -04:00
|
|
|
import Vue from 'vue';
|
2018-06-21 08:22:40 -04:00
|
|
|
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
|
2021-02-01 10:08:56 -05:00
|
|
|
import {
|
|
|
|
DIFF_FILE_MANUAL_COLLAPSE,
|
|
|
|
DIFF_FILE_AUTOMATIC_COLLAPSE,
|
|
|
|
INLINE_DIFF_LINES_KEY,
|
2022-04-20 17:08:12 -04:00
|
|
|
EXPANDED_LINE_TYPE,
|
2021-02-01 10:08:56 -05:00
|
|
|
} from '../constants';
|
2021-02-14 13:09:20 -05:00
|
|
|
import * as types from './mutation_types';
|
2018-09-01 17:24:29 -04:00
|
|
|
import {
|
|
|
|
findDiffFile,
|
|
|
|
addLineReferences,
|
|
|
|
removeMatchLine,
|
|
|
|
addContextLines,
|
2018-09-05 04:28:49 -04:00
|
|
|
prepareDiffData,
|
2018-09-08 02:37:41 -04:00
|
|
|
isDiscussionApplicableToLine,
|
2019-07-03 04:26:57 -04:00
|
|
|
updateLineInFile,
|
2018-09-01 17:24:29 -04:00
|
|
|
} from './utils';
|
2018-06-21 08:22:40 -04:00
|
|
|
|
2020-04-07 02:09:25 -04:00
|
|
|
function updateDiffFilesInState(state, files) {
|
|
|
|
return Object.assign(state, { diffFiles: files });
|
|
|
|
}
|
|
|
|
|
2020-10-26 08:08:44 -04:00
|
|
|
function renderFile(file) {
|
|
|
|
Object.assign(file, {
|
|
|
|
renderIt: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-06-21 08:22:40 -04:00
|
|
|
export default {
|
2018-06-26 14:49:22 -04:00
|
|
|
[types.SET_BASE_CONFIG](state, options) {
|
2019-11-26 04:08:36 -05:00
|
|
|
const {
|
|
|
|
endpoint,
|
|
|
|
endpointMetadata,
|
|
|
|
endpointBatch,
|
2020-03-17 14:09:44 -04:00
|
|
|
endpointCoverage,
|
2021-04-05 17:09:19 -04:00
|
|
|
endpointUpdateUser,
|
2019-11-26 04:08:36 -05:00
|
|
|
projectPath,
|
|
|
|
dismissEndpoint,
|
|
|
|
showSuggestPopover,
|
2021-01-19 07:10:46 -05:00
|
|
|
defaultSuggestionCommitMessage,
|
2020-12-02 16:09:44 -05:00
|
|
|
viewDiffsFileByFile,
|
2020-12-17 19:10:04 -05:00
|
|
|
mrReviews,
|
2019-11-26 04:08:36 -05:00
|
|
|
} = options;
|
|
|
|
Object.assign(state, {
|
|
|
|
endpoint,
|
|
|
|
endpointMetadata,
|
|
|
|
endpointBatch,
|
2020-03-17 14:09:44 -04:00
|
|
|
endpointCoverage,
|
2021-04-05 17:09:19 -04:00
|
|
|
endpointUpdateUser,
|
2019-11-26 04:08:36 -05:00
|
|
|
projectPath,
|
|
|
|
dismissEndpoint,
|
|
|
|
showSuggestPopover,
|
2021-01-19 07:10:46 -05:00
|
|
|
defaultSuggestionCommitMessage,
|
2020-12-02 16:09:44 -05:00
|
|
|
viewDiffsFileByFile,
|
2020-12-17 19:10:04 -05:00
|
|
|
mrReviews,
|
2019-11-26 04:08:36 -05:00
|
|
|
});
|
2018-06-21 08:22:40 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
[types.SET_LOADING](state, isLoading) {
|
|
|
|
Object.assign(state, { isLoading });
|
|
|
|
},
|
|
|
|
|
2021-09-08 14:11:23 -04:00
|
|
|
[types.SET_BATCH_LOADING_STATE](state, batchLoadingState) {
|
|
|
|
Object.assign(state, { batchLoadingState });
|
2019-11-26 04:08:36 -05:00
|
|
|
},
|
|
|
|
|
2019-12-19 07:07:35 -05:00
|
|
|
[types.SET_RETRIEVING_BATCHES](state, retrievingBatches) {
|
|
|
|
Object.assign(state, { retrievingBatches });
|
|
|
|
},
|
|
|
|
|
2020-04-07 02:09:25 -04:00
|
|
|
[types.SET_DIFF_FILES](state, files) {
|
|
|
|
updateDiffFilesInState(state, files);
|
|
|
|
},
|
|
|
|
|
2020-12-08 07:09:53 -05:00
|
|
|
[types.SET_DIFF_METADATA](state, data) {
|
2018-06-21 08:22:40 -04:00
|
|
|
Object.assign(state, {
|
2018-11-09 14:48:41 -05:00
|
|
|
...convertObjectPropsToCamelCase(data),
|
2018-08-07 05:14:00 -04:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-11-26 04:08:36 -05:00
|
|
|
[types.SET_DIFF_DATA_BATCH](state, data) {
|
2021-03-31 08:08:55 -04:00
|
|
|
state.diffFiles = prepareDiffData({
|
2020-12-15 04:10:00 -05:00
|
|
|
diff: data,
|
|
|
|
priorFiles: state.diffFiles,
|
|
|
|
});
|
2019-11-26 04:08:36 -05:00
|
|
|
},
|
|
|
|
|
2020-03-17 14:09:44 -04:00
|
|
|
[types.SET_COVERAGE_DATA](state, coverageFiles) {
|
2021-12-17 10:13:39 -05:00
|
|
|
Object.assign(state, { coverageFiles, coverageLoaded: true });
|
2020-03-17 14:09:44 -04:00
|
|
|
},
|
|
|
|
|
2018-08-07 05:14:00 -04:00
|
|
|
[types.RENDER_FILE](state, file) {
|
2020-10-26 08:08:44 -04:00
|
|
|
renderFile(file);
|
2018-06-21 08:22:40 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
[types.SET_MERGE_REQUEST_DIFFS](state, mergeRequestDiffs) {
|
|
|
|
Object.assign(state, {
|
2018-11-09 14:48:41 -05:00
|
|
|
mergeRequestDiffs,
|
2018-06-21 08:22:40 -04:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
[types.SET_DIFF_VIEW_TYPE](state, diffViewType) {
|
|
|
|
Object.assign(state, { diffViewType });
|
|
|
|
},
|
|
|
|
|
2018-11-09 04:44:07 -05:00
|
|
|
[types.TOGGLE_LINE_HAS_FORM](state, { lineCode, fileHash, hasForm }) {
|
2020-12-23 16:10:24 -05:00
|
|
|
const diffFile = state.diffFiles.find((f) => f.file_hash === fileHash);
|
2018-11-09 04:44:07 -05:00
|
|
|
|
|
|
|
if (!diffFile) return;
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
diffFile[INLINE_DIFF_LINES_KEY].find((l) => l.line_code === lineCode).hasForm = hasForm;
|
2018-06-21 08:22:40 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
[types.ADD_CONTEXT_LINES](state, options) {
|
2019-08-09 22:36:32 -04:00
|
|
|
const { lineNumbers, contextLines, fileHash, isExpandDown, nextLineNumbers } = options;
|
2018-06-21 08:22:40 -04:00
|
|
|
const { bottom } = options.params;
|
|
|
|
const diffFile = findDiffFile(state.diffFiles, fileHash);
|
|
|
|
|
|
|
|
removeMatchLine(diffFile, lineNumbers, bottom);
|
2018-10-16 12:21:16 -04:00
|
|
|
|
2019-08-09 22:36:32 -04:00
|
|
|
const lines = addLineReferences(
|
|
|
|
contextLines,
|
|
|
|
lineNumbers,
|
|
|
|
bottom,
|
|
|
|
isExpandDown,
|
|
|
|
nextLineNumbers,
|
2020-12-23 16:10:24 -05:00
|
|
|
).map((line) => {
|
2019-08-09 22:36:32 -04:00
|
|
|
const lineCode =
|
|
|
|
line.type === 'match'
|
|
|
|
? `${fileHash}_${line.meta_data.old_pos}_${line.meta_data.new_pos}_match`
|
|
|
|
: line.line_code || `${fileHash}_${line.old_line}_${line.new_line}`;
|
|
|
|
return {
|
|
|
|
...line,
|
2022-04-20 17:08:12 -04:00
|
|
|
type: line.type || EXPANDED_LINE_TYPE,
|
2019-08-09 22:36:32 -04:00
|
|
|
line_code: lineCode,
|
|
|
|
discussions: line.discussions || [],
|
|
|
|
hasForm: false,
|
|
|
|
};
|
|
|
|
});
|
2018-10-16 12:21:16 -04:00
|
|
|
|
2018-06-21 08:22:40 -04:00
|
|
|
addContextLines({
|
2020-11-19 13:09:13 -05:00
|
|
|
inlineLines: diffFile[INLINE_DIFF_LINES_KEY],
|
2018-06-21 08:22:40 -04:00
|
|
|
contextLines: lines,
|
|
|
|
bottom,
|
|
|
|
lineNumbers,
|
2019-08-09 22:36:32 -04:00
|
|
|
isExpandDown,
|
2018-06-21 08:22:40 -04:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
[types.ADD_COLLAPSED_DIFFS](state, { file, data }) {
|
2020-12-15 04:10:00 -05:00
|
|
|
const files = prepareDiffData({ diff: data });
|
2020-12-23 16:10:24 -05:00
|
|
|
const [newFileData] = files.filter((f) => f.file_hash === file.file_hash);
|
|
|
|
const selectedFile = state.diffFiles.find((f) => f.file_hash === file.file_hash);
|
2018-09-07 10:20:57 -04:00
|
|
|
Object.assign(selectedFile, { ...newFileData });
|
2018-06-21 08:22:40 -04:00
|
|
|
},
|
|
|
|
|
2019-07-03 04:26:57 -04:00
|
|
|
[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, { discussion, diffPositionByLineCode, hash }) {
|
2018-10-19 09:09:16 -04:00
|
|
|
const { latestDiff } = state;
|
|
|
|
|
2021-02-03 13:09:25 -05:00
|
|
|
const originalStartLineCode = discussion.original_position?.line_range?.start?.line_code;
|
|
|
|
const discussionLineCodes = [
|
|
|
|
discussion.line_code,
|
|
|
|
originalStartLineCode,
|
|
|
|
...(discussion.line_codes || []),
|
|
|
|
];
|
2018-10-25 07:04:34 -04:00
|
|
|
const fileHash = discussion.diff_file.file_hash;
|
2020-12-23 16:10:24 -05:00
|
|
|
const lineCheck = (line) =>
|
2020-04-21 11:21:10 -04:00
|
|
|
discussionLineCodes.some(
|
2020-12-23 16:10:24 -05:00
|
|
|
(discussionLineCode) =>
|
2020-04-21 11:21:10 -04:00
|
|
|
line.line_code === discussionLineCode &&
|
|
|
|
isDiscussionApplicableToLine({
|
|
|
|
discussion,
|
|
|
|
diffPosition: diffPositionByLineCode[line.line_code],
|
|
|
|
latestDiff,
|
|
|
|
}),
|
|
|
|
);
|
2018-12-12 14:29:48 -05:00
|
|
|
const mapDiscussions = (line, extraCheck = () => true) => ({
|
|
|
|
...line,
|
|
|
|
discussions: extraCheck()
|
2020-01-14 16:07:45 -05:00
|
|
|
? line.discussions &&
|
|
|
|
line.discussions
|
2018-12-12 14:29:48 -05:00
|
|
|
.filter(() => !line.discussions.some(({ id }) => discussion.id === id))
|
|
|
|
.concat(lineCheck(line) ? discussion : line.discussions)
|
|
|
|
: [],
|
|
|
|
});
|
2018-10-25 07:04:34 -04:00
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
const setDiscussionsExpanded = (line) => {
|
2020-01-14 16:07:45 -05:00
|
|
|
const isLineNoteTargeted =
|
|
|
|
line.discussions &&
|
|
|
|
line.discussions.some(
|
2020-12-23 16:10:24 -05:00
|
|
|
(disc) => disc.notes && disc.notes.find((note) => hash === `note_${note.id}`),
|
2020-01-14 16:07:45 -05:00
|
|
|
);
|
2019-07-03 04:26:57 -04:00
|
|
|
|
|
|
|
return {
|
|
|
|
...line,
|
|
|
|
discussionsExpanded:
|
|
|
|
line.discussions && line.discussions.length
|
2020-12-23 16:10:24 -05:00
|
|
|
? line.discussions.some((disc) => !disc.resolved) || isLineNoteTargeted
|
2019-07-03 04:26:57 -04:00
|
|
|
: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
state.diffFiles.forEach((file) => {
|
2020-01-14 07:07:41 -05:00
|
|
|
if (file.file_hash === fileHash) {
|
2020-11-19 13:09:13 -05:00
|
|
|
if (file[INLINE_DIFF_LINES_KEY].length) {
|
2020-12-23 16:10:24 -05:00
|
|
|
file[INLINE_DIFF_LINES_KEY].forEach((line) => {
|
2020-01-14 07:07:41 -05:00
|
|
|
Object.assign(
|
|
|
|
line,
|
|
|
|
setDiscussionsExpanded(lineCheck(line) ? mapDiscussions(line) : line),
|
|
|
|
);
|
|
|
|
});
|
2018-09-07 18:24:47 -04:00
|
|
|
}
|
2018-09-07 11:13:11 -04:00
|
|
|
|
2020-11-19 13:09:13 -05:00
|
|
|
if (!file[INLINE_DIFF_LINES_KEY].length) {
|
2020-01-14 07:07:41 -05:00
|
|
|
const newDiscussions = (file.discussions || [])
|
2020-12-23 16:10:24 -05:00
|
|
|
.filter((d) => d.id !== discussion.id)
|
2019-04-12 05:27:24 -04:00
|
|
|
.concat(discussion);
|
2018-10-25 07:04:34 -04:00
|
|
|
|
2020-01-14 07:07:41 -05:00
|
|
|
Object.assign(file, {
|
|
|
|
discussions: newDiscussions,
|
|
|
|
});
|
|
|
|
}
|
2018-10-19 09:09:16 -04:00
|
|
|
}
|
|
|
|
});
|
2018-09-05 04:28:49 -04:00
|
|
|
},
|
|
|
|
|
2018-12-12 14:29:48 -05:00
|
|
|
[types.REMOVE_LINE_DISCUSSIONS_FOR_FILE](state, { fileHash, lineCode }) {
|
2020-12-23 16:10:24 -05:00
|
|
|
const selectedFile = state.diffFiles.find((f) => f.file_hash === fileHash);
|
2018-09-07 18:24:47 -04:00
|
|
|
if (selectedFile) {
|
2020-12-23 16:10:24 -05:00
|
|
|
updateLineInFile(selectedFile, lineCode, (line) =>
|
2019-07-03 04:26:57 -04:00
|
|
|
Object.assign(line, {
|
2020-12-23 16:10:24 -05:00
|
|
|
discussions: line.discussions.filter((discussion) => discussion.notes.length),
|
2019-07-03 04:26:57 -04:00
|
|
|
}),
|
|
|
|
);
|
2018-10-18 03:50:38 -04:00
|
|
|
|
|
|
|
if (selectedFile.discussions && selectedFile.discussions.length) {
|
|
|
|
selectedFile.discussions = selectedFile.discussions.filter(
|
2020-12-23 16:10:24 -05:00
|
|
|
(discussion) => discussion.notes.length,
|
2018-10-18 03:50:38 -04:00
|
|
|
);
|
|
|
|
}
|
2018-09-07 11:13:11 -04:00
|
|
|
}
|
2018-09-05 04:28:49 -04:00
|
|
|
},
|
2019-07-03 04:26:57 -04:00
|
|
|
|
|
|
|
[types.TOGGLE_LINE_DISCUSSIONS](state, { fileHash, lineCode, expanded }) {
|
2020-12-23 16:10:24 -05:00
|
|
|
const selectedFile = state.diffFiles.find((f) => f.file_hash === fileHash);
|
2019-07-03 04:26:57 -04:00
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
updateLineInFile(selectedFile, lineCode, (line) => {
|
2020-01-14 07:07:41 -05:00
|
|
|
Object.assign(line, { discussionsExpanded: expanded });
|
|
|
|
});
|
2019-07-03 04:26:57 -04:00
|
|
|
},
|
|
|
|
|
2018-10-03 05:05:43 -04:00
|
|
|
[types.TOGGLE_FOLDER_OPEN](state, path) {
|
|
|
|
state.treeEntries[path].opened = !state.treeEntries[path].opened;
|
|
|
|
},
|
2020-11-27 07:09:14 -05:00
|
|
|
[types.SET_SHOW_TREE_LIST](state, showTreeList) {
|
|
|
|
state.showTreeList = showTreeList;
|
2018-10-03 05:05:43 -04:00
|
|
|
},
|
2021-11-04 17:13:55 -04:00
|
|
|
[types.SET_CURRENT_DIFF_FILE](state, fileId) {
|
2018-10-03 05:05:43 -04:00
|
|
|
state.currentDiffFileId = fileId;
|
2021-11-04 17:13:55 -04:00
|
|
|
},
|
|
|
|
[types.SET_DIFF_FILE_VIEWED](state, { id, seen }) {
|
|
|
|
Vue.set(state.viewedDiffFileIds, id, seen);
|
2018-10-03 05:05:43 -04:00
|
|
|
},
|
2018-10-18 03:50:38 -04:00
|
|
|
[types.OPEN_DIFF_FILE_COMMENT_FORM](state, formData) {
|
|
|
|
state.commentForms.push({
|
|
|
|
...formData,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
[types.UPDATE_DIFF_FILE_COMMENT_FORM](state, formData) {
|
|
|
|
const { fileHash } = formData;
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
state.commentForms = state.commentForms.map((form) => {
|
2018-10-18 03:50:38 -04:00
|
|
|
if (form.fileHash === fileHash) {
|
|
|
|
return {
|
|
|
|
...formData,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return form;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
[types.CLOSE_DIFF_FILE_COMMENT_FORM](state, fileHash) {
|
2020-12-23 16:10:24 -05:00
|
|
|
state.commentForms = state.commentForms.filter((form) => form.fileHash !== fileHash);
|
2018-10-18 03:50:38 -04:00
|
|
|
},
|
2018-11-30 03:48:47 -05:00
|
|
|
[types.SET_HIGHLIGHTED_ROW](state, lineCode) {
|
|
|
|
state.highlightedRow = lineCode;
|
|
|
|
},
|
2019-01-15 08:37:21 -05:00
|
|
|
[types.SET_TREE_DATA](state, { treeEntries, tree }) {
|
|
|
|
state.treeEntries = treeEntries;
|
|
|
|
state.tree = tree;
|
2020-07-30 11:09:40 -04:00
|
|
|
state.isTreeLoaded = true;
|
2019-01-15 08:37:21 -05:00
|
|
|
},
|
2019-01-24 09:48:03 -05:00
|
|
|
[types.SET_RENDER_TREE_LIST](state, renderTreeList) {
|
|
|
|
state.renderTreeList = renderTreeList;
|
|
|
|
},
|
|
|
|
[types.SET_SHOW_WHITESPACE](state, showWhitespace) {
|
|
|
|
state.showWhitespace = showWhitespace;
|
2020-04-09 11:09:29 -04:00
|
|
|
state.diffFiles = [];
|
2019-01-24 09:48:03 -05:00
|
|
|
},
|
2019-01-16 10:17:10 -05:00
|
|
|
[types.TOGGLE_FILE_FINDER_VISIBLE](state, visible) {
|
|
|
|
state.fileFinderVisible = visible;
|
|
|
|
},
|
2019-02-28 09:14:15 -05:00
|
|
|
[types.REQUEST_FULL_DIFF](state, filePath) {
|
|
|
|
const file = findDiffFile(state.diffFiles, filePath, 'file_path');
|
|
|
|
|
|
|
|
file.isLoadingFullFile = true;
|
|
|
|
},
|
|
|
|
[types.RECEIVE_FULL_DIFF_ERROR](state, filePath) {
|
|
|
|
const file = findDiffFile(state.diffFiles, filePath, 'file_path');
|
|
|
|
|
|
|
|
file.isLoadingFullFile = false;
|
|
|
|
},
|
2019-05-03 03:33:15 -04:00
|
|
|
[types.RECEIVE_FULL_DIFF_SUCCESS](state, { filePath }) {
|
2019-02-28 09:14:15 -05:00
|
|
|
const file = findDiffFile(state.diffFiles, filePath, 'file_path');
|
|
|
|
|
|
|
|
file.isShowingFullFile = true;
|
|
|
|
file.isLoadingFullFile = false;
|
|
|
|
},
|
2020-10-26 08:08:44 -04:00
|
|
|
[types.SET_FILE_COLLAPSED](
|
|
|
|
state,
|
|
|
|
{ filePath, collapsed, trigger = DIFF_FILE_AUTOMATIC_COLLAPSE },
|
|
|
|
) {
|
2020-12-23 16:10:24 -05:00
|
|
|
const file = state.diffFiles.find((f) => f.file_path === filePath);
|
2019-03-11 09:09:36 -04:00
|
|
|
|
|
|
|
if (file && file.viewer) {
|
2020-10-26 08:08:44 -04:00
|
|
|
if (trigger === DIFF_FILE_MANUAL_COLLAPSE) {
|
|
|
|
file.viewer.automaticallyCollapsed = false;
|
|
|
|
file.viewer.manuallyCollapsed = collapsed;
|
|
|
|
} else if (trigger === DIFF_FILE_AUTOMATIC_COLLAPSE) {
|
|
|
|
file.viewer.automaticallyCollapsed = collapsed;
|
|
|
|
file.viewer.manuallyCollapsed = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (file && !collapsed) {
|
|
|
|
renderFile(file);
|
2019-03-11 09:09:36 -04:00
|
|
|
}
|
|
|
|
},
|
2019-05-03 03:33:15 -04:00
|
|
|
[types.SET_CURRENT_VIEW_DIFF_FILE_LINES](state, { filePath, lines }) {
|
2020-12-23 16:10:24 -05:00
|
|
|
const file = state.diffFiles.find((f) => f.file_path === filePath);
|
2019-05-03 03:33:15 -04:00
|
|
|
|
2020-11-19 13:09:13 -05:00
|
|
|
file[INLINE_DIFF_LINES_KEY] = lines;
|
2019-05-03 03:33:15 -04:00
|
|
|
},
|
|
|
|
[types.ADD_CURRENT_VIEW_DIFF_FILE_LINES](state, { filePath, line }) {
|
2020-12-23 16:10:24 -05:00
|
|
|
const file = state.diffFiles.find((f) => f.file_path === filePath);
|
2019-05-03 03:33:15 -04:00
|
|
|
|
2020-11-19 13:09:13 -05:00
|
|
|
file[INLINE_DIFF_LINES_KEY].push(line);
|
2019-05-03 03:33:15 -04:00
|
|
|
},
|
|
|
|
[types.TOGGLE_DIFF_FILE_RENDERING_MORE](state, filePath) {
|
2020-12-23 16:10:24 -05:00
|
|
|
const file = state.diffFiles.find((f) => f.file_path === filePath);
|
2019-05-03 03:33:15 -04:00
|
|
|
|
|
|
|
file.renderingLines = !file.renderingLines;
|
|
|
|
},
|
2020-04-30 08:09:45 -04:00
|
|
|
[types.SET_DIFF_FILE_VIEWER](state, { filePath, viewer }) {
|
|
|
|
const file = findDiffFile(state.diffFiles, filePath, 'file_path');
|
|
|
|
|
|
|
|
file.viewer = viewer;
|
|
|
|
},
|
2019-06-14 09:01:24 -04:00
|
|
|
[types.SET_SHOW_SUGGEST_POPOVER](state) {
|
|
|
|
state.showSuggestPopover = false;
|
|
|
|
},
|
2020-12-02 16:09:44 -05:00
|
|
|
[types.SET_FILE_BY_FILE](state, fileByFile) {
|
|
|
|
state.viewDiffsFileByFile = fileByFile;
|
|
|
|
},
|
2020-12-17 19:10:04 -05:00
|
|
|
[types.SET_MR_FILE_REVIEWS](state, newReviews) {
|
|
|
|
state.mrReviews = newReviews;
|
|
|
|
},
|
2021-08-06 05:10:16 -04:00
|
|
|
[types.DISABLE_VIRTUAL_SCROLLING](state) {
|
|
|
|
state.disableVirtualScroller = true;
|
|
|
|
},
|
2018-06-21 08:22:40 -04:00
|
|
|
};
|