diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-14 11:41:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-14 11:41:52 +0300 |
commit | 585826cb22ecea5998a2c2a4675735c94bdeedac (patch) | |
tree | 5b05f0b30d33cef48963609e8a18a4dff260eab3 /app/assets/javascripts/diffs/store | |
parent | df221d036e5d0c6c0ee4d55b9c97f481ee05dee8 (diff) |
Add latest changes from gitlab-org/gitlab@16-6-stable-eev16.6.0-rc42
Diffstat (limited to 'app/assets/javascripts/diffs/store')
-rw-r--r-- | app/assets/javascripts/diffs/store/actions.js | 13 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/store/mutations.js | 7 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/store/utils.js | 2 |
3 files changed, 16 insertions, 6 deletions
diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index ed8ae795bda..fcaf8e99b2d 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -49,6 +49,7 @@ import { TRACKING_MULTIPLE_FILES_MODE, EVT_MR_PREPARED, FILE_DIFF_POSITION_TYPE, + EVT_DISCUSSIONS_ASSIGNED, } from '../constants'; import { DISCUSSION_SINGLE_DIFF_FAILED, @@ -89,6 +90,7 @@ export const setBaseConfig = ({ commit }, options) => { viewDiffsFileByFile, mrReviews, diffViewType, + perPage, } = options; commit(types.SET_BASE_CONFIG, { endpoint, @@ -104,6 +106,7 @@ export const setBaseConfig = ({ commit }, options) => { viewDiffsFileByFile, mrReviews, diffViewType, + perPage, }); Array.from(new Set(Object.values(mrReviews).flat())).forEach((id) => { @@ -206,7 +209,7 @@ export const fetchFileByFile = async ({ state, getters, commit }) => { }; export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { - let perPage = state.viewDiffsFileByFile ? 1 : 5; + let perPage = state.viewDiffsFileByFile ? 1 : state.perPage; let increaseAmount = 1.4; const startPage = 0; const id = window?.location?.hash; @@ -413,12 +416,16 @@ export const assignDiscussionsToDiff = ( } Vue.nextTick(() => { - notesEventHub.$emit('scrollToDiscussion'); + eventHub.$emit(EVT_DISCUSSIONS_ASSIGNED); }); }; export const removeDiscussionsFromDiff = ({ commit }, removeDiscussion) => { - const { file_hash: fileHash, line_code: lineCode, id } = removeDiscussion; + const { + diff_file: { file_hash: fileHash }, + line_code: lineCode, + id, + } = removeDiscussion; commit(types.REMOVE_LINE_DISCUSSIONS_FOR_FILE, { fileHash, lineCode, id }); }; diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index 31369b169f5..08c195469e3 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -39,6 +39,7 @@ export default { viewDiffsFileByFile, mrReviews, diffViewType, + perPage, } = options; Object.assign(state, { endpoint, @@ -54,6 +55,7 @@ export default { viewDiffsFileByFile, mrReviews, diffViewType, + perPage, }); }, @@ -198,9 +200,10 @@ export default { return { ...line, discussionsExpanded: - line.discussions && line.discussions.length + line.discussionsExpanded || + (line.discussions && line.discussions.length ? line.discussions.some((disc) => !disc.resolved) || isLineNoteTargeted - : false, + : false), }; }; diff --git a/app/assets/javascripts/diffs/store/utils.js b/app/assets/javascripts/diffs/store/utils.js index 15d2ab71bc8..fb467a606b9 100644 --- a/app/assets/javascripts/diffs/store/utils.js +++ b/app/assets/javascripts/diffs/store/utils.js @@ -338,7 +338,7 @@ function prepareLine(line, file) { problems.brokenSymlink || problems.fileOnlyMoved || problems.brokenLineCode, ), rich_text: cleanRichText(line.rich_text), - discussionsExpanded: true, + discussionsExpanded: false, discussions: [], hasForm: false, text: undefined, |