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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-04 21:08:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-04 21:08:46 +0300
commitb41cd8cb92d53454b2b160ba922d33801933a9cf (patch)
tree3519da8856f8bf12ce9e75248e5ecb9ed4eacf14 /app/assets/javascripts/diffs
parent8d3aee3636da5181ae94d23b47c6794b5610ab01 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/diffs')
-rw-r--r--app/assets/javascripts/diffs/components/app.vue31
-rw-r--r--app/assets/javascripts/diffs/store/actions.js2
-rw-r--r--app/assets/javascripts/diffs/store/mutations.js11
3 files changed, 31 insertions, 13 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue
index 8039a9a7602..beda1a0dc14 100644
--- a/app/assets/javascripts/diffs/components/app.vue
+++ b/app/assets/javascripts/diffs/components/app.vue
@@ -144,6 +144,9 @@ export default {
isLimitedContainer() {
return !this.showTreeList && !this.isParallelView && !this.isFluidLayout;
},
+ shouldSetDiscussions() {
+ return this.isNotesFetched && !this.assignedDiscussions && !this.isLoading;
+ },
},
watch: {
diffViewType() {
@@ -160,6 +163,11 @@ export default {
},
isLoading: 'adjustView',
showTreeList: 'adjustView',
+ shouldSetDiscussions(newVal) {
+ if (newVal) {
+ this.setDiscussions();
+ }
+ },
},
mounted() {
this.setBaseConfig({
@@ -214,26 +222,28 @@ export default {
isLatestVersion() {
return window.location.search.indexOf('diff_id') === -1;
},
+ startDiffRendering() {
+ requestIdleCallback(
+ () => {
+ this.startRenderDiffsQueue();
+ },
+ { timeout: 1000 },
+ );
+ },
fetchData(toggleTree = true) {
if (this.isLatestVersion() && this.glFeatures.diffsBatchLoad) {
this.fetchDiffFilesMeta()
.then(() => {
if (toggleTree) this.hideTreeListIfJustOneFile();
+
+ this.startDiffRendering();
})
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));
});
this.fetchDiffFilesBatch()
- .then(() => {
- requestIdleCallback(
- () => {
- this.setDiscussions();
- this.startRenderDiffsQueue();
- },
- { timeout: 1000 },
- );
- })
+ .then(() => this.startDiffRendering())
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));
});
@@ -246,7 +256,6 @@ export default {
requestIdleCallback(
() => {
- this.setDiscussions();
this.startRenderDiffsQueue();
},
{ timeout: 1000 },
@@ -262,7 +271,7 @@ export default {
}
},
setDiscussions() {
- if (this.isNotesFetched && !this.assignedDiscussions && !this.isLoading) {
+ if (this.shouldSetDiscussions) {
this.assignedDiscussions = true;
requestIdleCallback(
diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js
index d4594399ff5..5434184b450 100644
--- a/app/assets/javascripts/diffs/store/actions.js
+++ b/app/assets/javascripts/diffs/store/actions.js
@@ -119,7 +119,7 @@ export const fetchDiffFilesMeta = ({ commit, state }) => {
.get(state.endpointMetadata)
.then(({ data }) => {
const strippedData = { ...data };
- strippedData.diff_files = [];
+ delete strippedData.diff_files;
commit(types.SET_LOADING, false);
commit(types.SET_MERGE_REQUEST_DIFFS, data.merge_request_diffs || []);
commit(types.SET_DIFF_DATA, strippedData);
diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js
index de2f68d729c..fccfd950d75 100644
--- a/app/assets/javascripts/diffs/store/mutations.js
+++ b/app/assets/javascripts/diffs/store/mutations.js
@@ -39,7 +39,16 @@ export default {
},
[types.SET_DIFF_DATA](state, data) {
- prepareDiffData(data);
+ if (
+ !(
+ gon &&
+ gon.features &&
+ gon.features.diffsBatchLoad &&
+ window.location.search.indexOf('diff_id') === -1
+ )
+ ) {
+ prepareDiffData(data);
+ }
Object.assign(state, {
...convertObjectPropsToCamelCase(data),